note 42114 deleted from function.unset by nlopess
| From: | nlopess@php.net | Date: | Tue, 04 May 2004 13:25:03 +0000 |
| Subject: | note 42114 deleted from function.unset by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-69199@lists.php.net to get a copy of this message | ||
Note Submitter: David -NOSPAM-AT- inglesisimo -DOT- com
----
I wanted to know how to unset an array. I found the following answer here: http://www.phpfreaks.com/phpref/56.php
//unset() also works with arrays,
//with the correct method:
$array[0] = "test";
$array[1] = "test2";
//Don't do this:
unset($array);
//Use this instead:
foreach($array as $val)
unset($val);
The variables in the above example still exist, but now they have no value.
-- David.