Re: Problems with reference to caller in constructor
| From: | Adam Bregenzer | Date: | Wed, 28 Apr 2004 01:15:31 +0000 |
| Subject: | Re: Problems with reference to caller in constructor | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184818@lists.php.net to get a copy of this message | ||
On Tue, 2004-04-27 at 21:05, Craig Davey wrote:
> $u = new User();
> $u->set(); // sets firstname to 'joe'
> echo $u->save(); // returns null, I thought it should return 'joe'
>
You are calling set() on a copy of the newly created object; try:
$u =& new User();
as your first line.
--
Adam Bregenzer
adam@bregenzer.net
http://adam.bregenzer.net/