note 15662 added to function.array-slice
| From: | duez at ecf dot utoronto dot NOSPAM dot ca | Date: | Tue, 25 Sep 2001 15:05:16 +0000 |
| Subject: | note 15662 added to function.array-slice | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-18283@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
)
--
http://www.php.net/manual/en/function.array-slice.php
http://master.php.net/manage/user-notes.php?action=edit+15662
http://master.php.net/manage/user-notes.php?action=delete+15662
http://master.php.net/manage/user-notes.php?action=reject+15662