note 42114 added to function.unset
| From: | David-NOSPAM-AT-inglesisimo-DOT-com at rn2 dot php dot net | Date: | Mon, 03 May 2004 23:00:58 +0000 |
| Subject: | note 42114 added to function.unset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69178@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/function.unset.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42114
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42114&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42114&report=yes
Search -- http://master.php.net/manage/user-notes.php