note 73573 added to ref.array

From: Date: Thu, 01 Mar 2007 21:45:08 +0000
Subject: note 73573 added to ref.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-123997@lists.php.net to get a copy of this message
/* Correcting me last post */ /** * 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);$x++) { $i=array_search($val,$array_remval); if (is_numeric($i)) { $array_temp = array_slice($array_remval, 0, $i ); $array_temp2 = array_slice($array_remval, $i+1, count($array_remval)-1 ); $array_remval = array_merge($array_temp, $array_temp2); } } return $array_remval; } $stack=Array('apple','banana','pear','apple', 'cherry', 'apple'); array_remval("apple", $stack); //output: Array('banana','pear', 'cherry') ---- 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/73573 Del: integrated -- https://master.php.net/note/delete/73573/integrated Del: useless -- https://master.php.net/note/delete/73573/useless Del: bad code -- https://master.php.net/note/delete/73573/bad+code Del: spam -- https://master.php.net/note/delete/73573/spam Del: non-english -- https://master.php.net/note/delete/73573/non-english Del: in docs -- https://master.php.net/note/delete/73573/in+docs Del: other reasons-- https://master.php.net/note/delete/73573 Reject -- https://master.php.net/note/reject/73573 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123997) next »