RE:[PHP] Removing All Instances From An Array
| From: | bojan at inet dot co dot yu | Date: | Wed, 12 Jul 2000 23:35:11 +0000 |
| Subject: | RE:[PHP] Removing All Instances From An Array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-6262@lists.php.net to get a copy of this message | ||
while (list($key,$value)=each($array)){
if ($key==$picked){
unset($array[$key]);
}
}
--
Bojan Gajic
<bojan@inet.co.yu>
fisherres@msn.com wrote:
>Hello,
>
>1. I have an array $array = array (1,2,3,3,3,4,5,6,7,8,9,9);
>2. The variable $picked has the value 2.
>3. If I print the value of $array[$picked] I see the number three.
>4. Well instead of printing the number three I want to remove all instances
>of 3 from the array. So, my array should look like $array = array
>(1,2,4,5,6,7,8,9,9);
>
> Basically, whatever the value of $array[picked] is, I want to remove all
>instances of that value from the array.
>
>Andrew
>digi-FX
>-------------------------------
>http://www.digi-FX.net
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>