note 75114 added to function.array-splice
| From: | leonardolaporte at gmail dot com | Date: | Sun, 13 May 2007 08:06:33 +0000 |
| Subject: | note 75114 added to function.array-splice | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-126472@lists.php.net to get a copy of this message | ||
My Remove function.
function array_remove($search_item, $search_array) {
$key = array_search($search_item, $search_array);
$array_begin = array_slice($search_array, 0, $key);
$array_end = array_slice($search_array, $key+1);
$array_final = array_merge($array_begin, $array_end);
return $array_final;
}
$search = 'item3';
$array_ex = array('item1', 'item2', 'item3', 'item4',
'item5');
print_r(array_remove($search, $array_ex)); // return Array ( [0] => item1 [1] => item2 [2]
=> item4 [3] => item5 )
Contact: leonardolaporte@gmail.com
Brazil!!!
----
Server IP: 69.147.83.197
Probable Submitter: 201.8.164.164
----
Manual Page -- http://www.php.net/manual/en/function.array-splice.php
Edit -- https://master.php.net/note/edit/75114
Del: integrated -- https://master.php.net/note/delete/75114/integrated
Del: useless -- https://master.php.net/note/delete/75114/useless
Del: bad code -- https://master.php.net/note/delete/75114/bad+code
Del: spam -- https://master.php.net/note/delete/75114/spam
Del: non-english -- https://master.php.net/note/delete/75114/non-english
Del: in docs -- https://master.php.net/note/delete/75114/in+docs
Del: other reasons-- https://master.php.net/note/delete/75114
Reject -- https://master.php.net/note/reject/75114
Search -- https://master.php.net/manage/user-notes.php