在PHP 5.3中不推荐使用引用来指定new的返回值

hd.*_*hd. 2 php migration deprecated

我的网站在此行中有一个弃用的错误:

$obj =& new $class($table,$primkeyArr,$this);
Run Code Online (Sandbox Code Playgroud)

这是因为&.它给出了这个错误:

Deprecated: Assigning the return value of new by reference is deprecated in ....
Run Code Online (Sandbox Code Playgroud)

这是php 5.3中的一个问题.

如果我&从此行中删除,则错误消失.但是,如果我将我的网站放在PHP版本较低(5.2)的服务器上,我不知道是否会引起任何问题.

&在PHP 5.2和PHP 5.3中都可以删除工作吗?

Max*_*sky 5

在PHP 5中,默认情况下,对象以类似引用的方式处理.所以删除&可能不会改变任何东西.

但是,通过引用分配打破旧引用,可能仍然存在差异.