How do I change a static variables value in PHP?

后端 未结 4 784
天命终不由人
天命终不由人 2020-12-16 03:56

This is a simplified version of what I want to accomplish:

In my script I want a variable that changes true and false everytime the script is executed.



        
4条回答
  •  一整个雨季
    2020-12-16 04:55

    I think you need to better understand the point of a static variable. The storage for the variable is allocated (and deallocated) on the call stack, so from a software engineering point of view, its value cannot be changed in run time.

    There are better solutions as suggested above for this.

提交回复
热议问题