I have a question regarding assigning a session variable in PHP. I want to set a variable to 0 only once, and then keep its value unchanged throughout the session.
Let me give you some context. I'm building a web application where users can track their progress. I have a session variable called "totalPoints" that keeps track of the user's accumulated points. Initially, when a user starts using the application, I want to set the "totalPoints" variable to 0. However, I want to make sure that this value remains unchanged for the entire session, even if the user refreshes the page or navigates to different sections of the application.
Could someone please guide me on how to achieve this in PHP? I've tried various approaches, but I'm unsure which one is the most efficient and reliable option.
I appreciate any help or suggestions you can provide. Thank you in advance!