以下有区别吗?
$myVar=&new MyClass();
$myVar=new MyClass();
我正在用 PHP 编写代码
最佳答案
如果使用 PHP5,则没有区别。
如果使用 PHP4,前者传递对新对象的引用。
This is because "new" does not return a reference by default, instead it returns a copy.
Source .
关于php - PHP 中的 new MyClass() 与 new MyClass(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8220791/