Variable assignment? Assign a value to a variable.
$ Foo = 25;
If this statement is executed, are two buckets in the memory? one is the storage value 25, and the other is the address with the value 25.
Is my understanding as follows correct?
Otherwise, the value of 25 should be released when unset is used to open up a space:
$ Foo = 25;
$ Boo = & $ foo;
Unset ($ boo );
Echo $ foo; // output 25
Reply to discussion (solution)
Buddy, the reference section after PHP5.4 has changed
$ Foo = 25; $ boo = $ foo; unset ($ boo); echo $ foo; // output 25 func (& $ var); function func (& $ var) {// A series of operations on $ var}. However, in php5.4 and later versions, the transfer of references to arrays and objects has changed, like this: func ($ var ); // note that the function is no longer called, but function func (& $ var) is also defined {// processing a series of operations on $ var}
This is like creating a shortcut on the desktop. you have deleted the shortcut, but the content is still in the original location.
Wait for the big bird...
If you are using unset (); the reference relationship of the variables referenced by it is still there, the memory will not be released yet, the released memory zone will be released only when all variables are disconnected from this memory zone.
If you are using unset (); the reference relationship of the variables referenced by it is still there, the memory will not be released yet, the released memory zone will be released only when all variables are disconnected from this memory zone.
Thank you for replying. Hello, I just want to know if the PHP parser has changed $ foo = 25 in the memory. can you give me some advice? thank you!
If it is an object
Then $ foo stores the object address.
$ Boo = $ foo only copies an address to him.
However, data 25 is only a value, so there is no 25. this object address is directly a value.
$ Boo stores the address of $ foo.
This post was last edited by xuzuning at 14:03:00, January 22 ,.
Php variable management can be simplified to maintain such a table