note 75114 deleted from function.array-splice by nlopess

From: Date: Sun, 13 May 2007 15:35:13 +0000
Subject: note 75114 deleted from function.array-splice by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-126483@lists.php.net to get a copy of this message
Note Submitter: leonardolaporte at gmail dot com ---- 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!!!

« previous php.notes (#126483) next »