An example Analysis of the existence form of php object in memory
This article mainly introduces the example analysis of the existing form of php objects in memory, which is very detailed and has a certain reference value. Interested friends must read it!
The specific analysis is as follows:
(1) $p1 corresponds to the memory address, which is assumed to be 0x123, ($p1 and the address are stored in the stack area, which is equivalent to the index when we look up the dictionary)
(2) find the heap area through the index of the memory address. Data such as "Xiao Wang" and "80" are stored in the storage area.
(3) $p2 = $p1, which actually passes the memory address 0x123 of $p1 to $p2, and the attribute $name,$age in the heap area remains unchanged, that is, it will not be copied again. So, when you change $p2-> age=85, the value of $p1-> age also changes.
The above is all the contents of the article "sample Analysis of the existence form of php objects in memory". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!