Home >Backend Development >PHP Tutorial >PHP static variable testing, beginner PHP static variable error analysis
The three values in the book are 1, 2, and 3 respectively
However, the actual result is that it cannot be run, and the syntax is wrong. The reason for the post-check error is that the sentence $int+1." Modify the code to the following to make it correct:
Note that the static keyword must be together with the assignment (php static static variable modifier usage), if it is written in the book staitc $int; $int=0;Error, the result after running is also 1, 1, 1 |