Home >Backend Development >PHP Tutorial >Static variable changes before call?
<code>class Test { static $name='app'; static $age=30; }</code>
<code>$name=Test::$name; echo $name;</code>
How to change the value of $name before returning in Test?
<code>class Test { static $name='app'; static $age=30; }</code>
<code>$name=Test::$name; echo $name;</code>
How to change the value of $name before returning in Test?
If a static variable is changed by you, why would it be called a static variable?
Why do you need to change the value of a static variable before using it? The original intention of static variable setting is to serve as an initial value for calling. You can reassign the static variable and assign it dynamically before using this value