Re: Unsetting vars when not needed?
| From: | Jordi Canals | Date: | Fri, 12 Nov 2004 13:53:13 +0000 |
| Subject: | Re: Unsetting vars when not needed? | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-52145@lists.php.net to get a copy of this message | ||
Lo siento ... lo envié a la lista equivocada :(
On Fri, 12 Nov 2004 14:20:47 +0100, Jordi Canals <jcanals@gmail.com> wrote:
> Hi all,
>
> I was working now in a new site developed with PHP 5.0.2 and a wonder
> came to me:
>
> Is usefull and recommended to unset a class instance when not needed?
>
> Specially when the class was instantiated inside a function and the
> function ends. In this case, the system should automatically destroy
> the instance (as it is a local var inside a function).
>
> If we manually unset the instance at the end of the function, does
> this affect the PHP performance? I mean, will PHP have to do an extra
> job unsetting the var?
>
> Also, the same question arises with database results. Is it worth to
> call mysql_free_result at the end of a function that uses it? Must
> take into consideration that there are lots of functions that use lots
> of MySQL results.
>
> Thanks for any comment
> Jordi.
>