note 73555 added to ref.array
| From: | aflavioatgmaildotcom at osu1 dot php dot net | Date: | Thu, 01 Mar 2007 07:39:39 +0000 |
| Subject: | note 73555 added to ref.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123974@lists.php.net to get a copy of this message | ||
/**
* Remove a value from a array
* @param string $val
* @param array $arr
* @return array $array_remval
*/
function array_remval($val, &$arr)
{
$array_remval = $arr;
for($x=0;$x<count($array_remval)-1;$x++)
{
$i=array_search($val,$array_remval);
//if($i===false)return false;
if ($i){
$array_remval=array_merge(array_slice($array_remval, 0,$i), array_slice($array_remval, $i+1));
}
}
return $array_remval;
}
$stack = array("orange", "banana", "apple", "raspberry",
"apple", "pear");
output array_remval("apple",$stack):
array("orange", "banana", "raspberry", "pear");
----
Server IP: 69.147.83.197
Probable Submitter: 201.80.162.156
----
Manual Page -- http://www.php.net/manual/en/ref.array.php
Edit -- https://master.php.net/note/edit/73555
Del: integrated -- https://master.php.net/note/delete/73555/integrated
Del: useless -- https://master.php.net/note/delete/73555/useless
Del: bad code -- https://master.php.net/note/delete/73555/bad+code
Del: spam -- https://master.php.net/note/delete/73555/spam
Del: non-english -- https://master.php.net/note/delete/73555/non-english
Del: in docs -- https://master.php.net/note/delete/73555/in+docs
Del: other reasons-- https://master.php.net/note/delete/73555
Reject -- https://master.php.net/note/reject/73555
Search -- https://master.php.net/manage/user-notes.php