I do not understand PHP references code that combines & and [] -
I'm reading some code in a library (SimplePie) and I'm trying to find some memory issues. I found the code that looks like the bottom and I do not know what it does
"; Var_dump ($ A1); Echo "
"; Var_dump ($ a3); ? & Gt; is output
array (3) {[0] = & gt; String (7) "a1first" [1] = & gt; Int (2) [2] = & gt; Int (3)} Null string (3) "BBB" array (1) {[0] = & gt; Array (4) {[0] = & gt; String (7) "a1first" [1] = & gt; Int (2) [2] = & gt; Int (3) [3] = & gt; & Amp; My question is, what does this line do and when it is used $ a1 = (3) "BBB"}}
& Amp; $ [] A1;
= & amp; Instead of making a copy of the side, instead of making a copy of the right hand.
$ a1 is an array, and $ a1 [] refers to the next empty position in the array, so you can say:
$ a1 [] = 4; and 4 will be added to the existing array $ a1 .
I'm not sure if [] is located to the right of an assignment, but what is this code
$ a1 = & amp; ; $ [] A1; What is the value of $ a1 is $ a1 is an indicator (reference) for the new value, obviously this is a bit circular So, I'm not sure what the point is!
Comments
Post a Comment