对象引用问题
class A{<br /> public $foo = 1;<br />}<br />$a = new A();<br />$b = $a;<br />$b->foo = 2;<br />echo $a->foo . "<br />";<br /><br />$c = new A();<br />$d = & $c;<br />$d->foo = 3;<br />echo $c->foo;
$b=$a 和 $d=&$c 有什么区别啊,这里用不用 & 都没什么不同
------解决方案--------------------= 传值
=& 传引用
对象总是以 引用 传递的
所以对于对象 = 和 =& 没有区别
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn