When the younger brother is absent, ask static questions static $ aryarray (); $ ary [] a; print_r ($ ary); die (); static $ aryarray (aaa, bbb ); $ ary [] a; print_r ($ ary); why is the output of this code Array ([0] & gt; aaa [1] & gt; not a bb hacker, ask static questions
Static $ ary = array ();
$ Ary [] = 'a ';
Print_r ($ ary); die ();
Static $ ary = array ('AAA', 'BBB ');
$ Ary [] = 'a ';
Print_r ($ ary );
Why is the output of this code
Array ([0] => aaa [1] => bbb [2] =>)
Will the static statement be executed first? No, right ?!
------ Solution --------------------
Yes, you can think so.
Static is interpreted as an internal function by php and executed before the php program.
Therefore, static variables can have initial values, but the initial values cannot contain variables.
In other words, it may be easier to understand:
Static variables have been assigned a value at the beginning of the program.