note 43626 added to function.unset
| From: | dasprid at web dot de | Date: | Mon, 28 Jun 2004 15:10:03 +0000 |
| Subject: | note 43626 added to function.unset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-72042@lists.php.net to get a copy of this message | ||
This is my function to completly clear an array. The only problem is, that it can't destroy the
array.
<?php
function unset_array (&$array) {
if (!is_array($array)) return false;
foreach ($array AS $key => $value) {
if (is_array($array[$key])) unset_array($array[$key]);
unset($array[$key]);
}
return true;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.unset.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43626
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43626&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43626&report=yes
Search -- http://master.php.net/manage/user-notes.php