I have this code:
$config = & my__frame::get('config');
Sometimes it returns:
PHP Strict Error: Only variables should be assigned by reference
and sometimes it don't. What should I do in that case?
I have this code:
$config = & my__frame::get('config');
Sometimes it returns:
PHP Strict Error: Only variables should be assigned by reference
and sometimes it don't. What should I do in that case?
You should remove the &
(ampersand) symbol, so that the instruction will look like this:
$config = my__frame::get('config');
Citing the manual:
As of PHP 5, the new operator returns a reference automatically, so assigning the result of new by reference results in an E_DEPRECATED message in PHP 5.3 and later, and an E_STRICT message in earlier versions.