Array remove function?

From: Date: Tue, 10 Apr 2007 19:49:57 +0000
Subject: Array remove function?
Groups: php.general 
Request: Send a blank email to php-general+get-252450@lists.php.net to get a copy of this message
Hi, Is there currently a function that removes a key/value from an array? I use this code right now: function array_remove($array,$remove,$remove_value = true) { foreach($array as $key => $value) { if($remove_value && $value != $remove) { $new_array[$key] = $value; } elseif (!$remove_value && $key != $remove) { $new_array[$key] = $value; } } return $new_array; } array_remove(array(1=>2,2=>3),2,true); // array (2=>3) array_remove(array(1=>2,2=>3),2,false); // array (1=>2) Anyone knows if there already exists such function? Else should i create future request? Tijnema

« previous php.general (#252450) next »