PHP6 return by reference deprecation
| From: | Paul M Foster | Date: | Sat, 02 May 2009 05:07:04 +0000 |
| Subject: | PHP6 return by reference deprecation | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-292207@lists.php.net to get a copy of this message | ||
In another thread (which I mercifully declined to highjack), someone
cited:
> Taken from
> http://www.corephp.co.uk/archives/19-Prepare-for-PHP-6.html
And I read this:
Both '$foo =& new StdClass()' and 'function &foo' will now raise an
E_STRICT error.
I don't use this much, but where I do, it's vital. Typically, I use it
to ensure a single copy of the $config for an application, as:
function &get_config() ...
and/or:
$cfg =& get_config();
If this is going away, how do you return things by reference, so as to
ensure a single copy of something (yes, I know the singleton pattern can
be used; I do use it as well; it's more complicated)?
Paul
--
Paul M. Foster