note 75843 deleted from function.unset by googleguy
| From: | googleguy@php.net | Date: | Wed, 02 Jan 2013 21:29:19 +0000 |
| Subject: | note 75843 deleted from function.unset by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-192736@lists.php.net to get a copy of this message | ||
Note Submitter: chris at maedata dot com
----
Regarding the 14-May-2007 note from anonymous:
As far as array elements go, unset() is really only useful for removing named keys. For numeric
keys, you can use array_splice to "unset" the element.
<?php
$a = array(
'foo' => array('a', 'b', 'c'),
'bar' => array('d', 'e', 'f')
);
print_r($a);
array_splice($a['foo'], 1, 1);
print_r($a);
unset($a['foo']);
print_r($a);
?>