Re: Emptying a Single Array Value

From: Date: Wed, 12 Jun 2002 18:58:37 +0000
Subject: Re: Emptying a Single Array Value
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-101795@lists.php.net to get a copy of this message
This is all i've ever been able to do: function ck_removeValueFromArray($array, $value) { $key = array_search($value, $array); if ($key) { $array[$key] = ""; rsort($array); // rsort() puts blank values at the end reset($array); array_pop($array); //use array_pop to remove the blank } return $array; } MC> Howdy, MC> If someone out there could tell me how to get rid of a single key/index pair within an array, MC> it would be great. I've tried both unset() and empty(), but both destroy the entire array. MC> Please CC me directly, as I'm on the digest. MC> Thanks in advance! MC> Martin MC> -- MC> PHP General Mailing List (http://www.php.net/) MC> To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#101795) next »