note 15662 deleted from function.array-slice by jimw
| From: | jimw@php.net | Date: | Mon, 10 Dec 2001 23:29:15 +0000 |
| Subject: | note 15662 deleted from function.array-slice by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22461@lists.php.net to get a copy of this message | ||
If you just want to remove one or more array elements while keeping the keys intact, just use the
"unset" command!
<P>
<?
$array = array("a", "b", 12=>"c",
"foo"=>"d");
print_r($array);
// now unset one of the elements
unset($array[1]);
print_r($array);
?>
this will give you
Array
(
[0] => a
[1] => b
[12] => c
[foo] => d
)
Array
(
[0] => a
[12] => c
[foo] => d
)