6

PHP 的变量赋值是深拷贝还是浅拷贝?

 2 years ago
source link: https://www.oschina.net/question/272738_2323658
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

PHP 的变量赋值是深拷贝还是浅拷贝?

帖子列表 发布于 昨天 16:49
阅读 203

PHP 的变量赋值是深拷贝还是浅拷贝?

祺爸PiscDong
昨天 17:46

普通对象是深拷贝,但对对象来说,是浅拷贝。也就是说,对象的赋值是引用赋值

赵开锦
今天 10:58
回复 @帖子列表 : PHP手册中有说过这个 https://www.php.net/manual/zh/language.oop5.references.php PHP 的引用是别名,就是两个不同的变量名字指向相同的内容。在 PHP 5,一个对象变量已经不再保存整个对象的值。只是保存一个标识符来访问真正的对象内容。 当对象作为参数传递,作为结果返回,或者赋值给另外一个变量,另外一个变量跟原来的
帖子列表
今天 08:40
对象没加 & 为什么是引用赋值?

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK