Re: Reference Notice
| From: | Andrey Nikolaev | Date: | Wed, 20 Jul 2005 11:57:59 +0000 |
| Subject: | Re: Reference Notice | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-17342@lists.php.net to get a copy of this message | ||
And another situation...
<?php
function &a() {
if(1==2)
return new B; //some reference...
else
return null; //error, we cant create B
}
$b_instance = a();
?>
And we got Notice...
Notice: Only variable references should be returned by reference in - on line 6
But if we modify code to:
<?php
function &a() {
$b = null;
if(1==2)
return new B;
else
return $b;
}
$b_instance = a();
?>
Than all ok, no notices, and i got what i want... but it's a kludge :-/