Re: Referencing function return value
| From: | Miguel Cruz | Date: | Mon, 08 Jul 2002 06:14:18 +0000 |
| Subject: | Re: Referencing function return value | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-106035@lists.php.net to get a copy of this message | ||
On Sun, 7 Jul 2002, Anas Mughal wrote:
> I have a general question about referencing...
>
> Would it be safe to reference a function return value?
Sure, unless the function returned a reference itself, in which case you
have to continue keeping track of the validity of that reference (i.e., if
its object gets unset(), I'm pretty sure it becomes invalid).
If a function returns a scalar or array, it's recreated in the caller's
context and will remain there until you explicitly get rid of it. It's not
like C where strings are pointers whose contents can disappear out from
under you at any moment.
miguel