note 73554 added to ref.array
| From: | aflavioatgmaildotcom at osu1 dot php dot net | Date: | Thu, 01 Mar 2007 07:29:45 +0000 |
| Subject: | note 73554 added to ref.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123973@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;
$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");
output $stack = array("orange", "banana", "raspberry");
----
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/73554
Del: integrated -- https://master.php.net/note/delete/73554/integrated
Del: useless -- https://master.php.net/note/delete/73554/useless
Del: bad code -- https://master.php.net/note/delete/73554/bad+code
Del: spam -- https://master.php.net/note/delete/73554/spam
Del: non-english -- https://master.php.net/note/delete/73554/non-english
Del: in docs -- https://master.php.net/note/delete/73554/in+docs
Del: other reasons-- https://master.php.net/note/delete/73554
Reject -- https://master.php.net/note/reject/73554
Search -- https://master.php.net/manage/user-notes.php