The above is the result of my own operation.
That's what the manual says, don't know what to say:
Reference is not what
As mentioned earlier, references are not pointers. This means that the following structure does not produce the effect you expect:
This causes the $var variables in the Foo function to be bound together with the $bar when the function is called, but is then re-bound to the $GLOBALS ["Baz"]. It is not possible to bind $bar to other variables within the scope of a function call by means of a reference mechanism, because there is no variable $bar in the function foo (it is represented as a $var, but $var only the contents of the variable without calling the name-to-value binding in the symbol table).
Its own understanding is that $c is already a reference, and PHP does not allow it to be assigned another reference. If you assign another reference to it, the reference $c is automatically disconnected from the $ A variable, so the output is two 2. I don't know if that's right.
Reply content:
The above is the result of my own operation.
That's what the manual says, don't know what to say:
Reference is not what
As mentioned earlier, references are not pointers. This means that the following structure does not produce the effect you expect:
This causes the $var variables in the Foo function to be bound together with the $bar when the function is called, but is then re-bound to the $GLOBALS ["Baz"]. It is not possible to bind $bar to other variables within the scope of a function call by means of a reference mechanism, because there is no variable $bar in the function foo (it is represented as a $var, but $var only the contents of the variable without calling the name-to-value binding in the symbol table).
Its own understanding is that $c is already a reference, and PHP does not allow it to be assigned another reference. If you assign another reference to it, the reference $c is automatically disconnected from the $ A variable, so the output is two 2. I don't know if that's right.
What you understand is right. A reference is also a data type that is relative to an integer, a floating-point type, and assigns another value to it, of course, to overwrite the original. Another reason why the unset () function can break a referenced relationship is this.
I don't know what you mean.
But this is the standard result of the pointer in C.
The first parameter is a reference, but $ A passes the variable, and the variable memory content is 2,& $a is the pointer,& $a expression is the value of a represents the memory address
The first foo you pass a $ A is a 2, which is the address of a.
And even if the C language foo (int *p) you call Foo (&a), and then you a=2, finally in print a, he output is also 2 Ah, your print star A (this star can not be hit)!
How can you change an external variable without sending an address?
You have to pass the address!
I really don't understand the reference in PHP, and what's the difference between a pointer in C