note 82422 added to function.array-pop
| From: | (adityabhai@gmail.com) | Date: | Thu, 10 Apr 2008 04:23:11 +0000 |
| Subject: | note 82422 added to function.array-pop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138091@lists.php.net to get a copy of this message | ||
<?
/*
function To Remove a single element from an array
*/
$array = array("1" => "1", "2" => "2", "3"
=> "3", "4" => "4");
foreach($array as $key => $value) {
if($value == "" || $value == " " || is_null($value)) {
unset($array[$key]);
}
}
/*
and if you want to create a new array with the keys reordered accordingly...
*/
$new_array = array_values($array);
?>
----
Server IP: 59.162.86.33
Probable Submitter: 59.162.251.99
----
Manual Page -- http://www.php.net/manual/en/function.array-pop.php
Edit -- https://master.php.net/note/edit/82422
Del: integrated -- https://master.php.net/note/delete/82422/integrated
Del: useless -- https://master.php.net/note/delete/82422/useless
Del: bad code -- https://master.php.net/note/delete/82422/bad+code
Del: spam -- https://master.php.net/note/delete/82422/spam
Del: non-english -- https://master.php.net/note/delete/82422/non-english
Del: in docs -- https://master.php.net/note/delete/82422/in+docs
Del: other reasons-- https://master.php.net/note/delete/82422
Reject -- https://master.php.net/note/reject/82422
Search -- https://master.php.net/manage/user-notes.php