Please explain, please explain why the output of Mao is not 1,23;---1,23;----1,23; Good people have a safe life.
That——————————————
I will put the code here first, good people will have a safe life
<?php
echo '<hr />';
function foo2(){
static $bar1;
$bar1 ;
echo "Befor unset: $bar1,<br />";
unset( $bar1 );
$bar1 = 23;
echo "after unset: $bar1\n<hr />";
}
foo2 ();
foo2 ();
foo2 ();
?>
余生请多赐教2017-11-09 16:40:09
http://php.net/manual/zh/function.unset.php
The manual contains the sentence on the second floor, you can understand it
lhpllpp2017-11-09 10:49:55
If you unset() a static variable in a function, the static variable will be destroyed inside the function. However, when this function is called again, this static variable will be restored to the value it had before it was last destroyed.
This is the original words of the document! ! !