Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

An example Analysis of the existence form of php object in memory

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report