Re: Re: unset array here?

From: Date: Fri, 26 Jul 2002 17:45:53 +0000
Subject: Re: Re: unset array here?
Groups: php.general 
Request: Send a blank email to php-general+get-109836@lists.php.net to get a copy of this message
> >Hello, > > > >I have this example code: > >function doprint($a){foreach($a as $value)echo $value;} > >doprint(array('1','test','hello','and')); > > > >Question, is the array in memory after the function call? > >So, should it be better to use this: > > > >function doprint($a){foreach($a as $value)echo $value;} > >doprint($temp=array('1','test','hello','and')); > >unset($temp); There are 2 variants. In the first PHP does not free the memory but there is no variable. In the second PHP frees the memory. The former case is the faster. Which variant is used depends on a constant during compilation. Andrey

« previous php.general (#109836) next »