开发者

PHP code causing "deprecated" error in PHP 5.3

开发者 https://www.devze.com 2023-01-21 08:23 出处:网络
The following code causes a \'deprecated\' error in PHP 5.3... Is there a substitute for it? $this->widgets[$widget_class] = 开发者_运维知识库& new $widget_class();

The following code causes a 'deprecated' error in PHP 5.3... Is there a substitute for it?

$this->widgets[$widget_class] = 开发者_运维知识库& new $widget_class();


It'd be nice if you could specify what exactly the error message says, but I'm guessing it's informing you that object assignment by reference (=&) is deprecated. Objects are always assigned and passed by reference as of PHP 5, so including & is unnecessary. Simply drop the reference operator:

$this->widgets[$widget_class] = new $widget_class();
0

精彩评论

暂无评论...
验证码 换一张
取 消