Re: cvs: pear /Auth_PrefManager2 PrefManager2.php
| From: | Daniel Convissor | Date: | Tue, 29 Jun 2004 16:57:00 +0000 |
| Subject: | Re: cvs: pear /Auth_PrefManager2 PrefManager2.php | ||
| References: | 1 | Groups: | php.pear.cvs |
| Request: | Send a blank email to pear-cvs+get-21261@lists.php.net to get a copy of this message | ||
Hi Jon:
On Tue, Jun 29, 2004 at 04:48:11PM -0000, Jon Wood wrote:
> jellybob Tue Jun 29 12:48:11 2004 EDT
>
> Modified files:
> /pear/Auth_PrefManager2 PrefManager2.php
> function &factory($container, $options = array())
> {
... snip ...
> + return new $class($options);
To _ensure_ methods that return by reference work correctly, it's best to
assign items to a variable then return the variable.
$obj = new $class($options);
return $obj;
Plus, if you're working in PHP 4, it's more efficient to assign by
reference when creating the new object:
$obj = &new $class($options);
return $obj;
--Dan
--
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
data intensive web and database programming
http://www.AnalysisAndSolutions.com/
4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409