Re: Removing Certain Key==>Val from an array...

From: Date: Wed, 26 Sep 2001 21:34:34 +0000
Subject: Re: Removing Certain Key==>Val from an array...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-68925@lists.php.net to get a copy of this message
Here's one way : $bye = 'jennifer lopez'; foreach ($cart as $title => $value) { if (!strcasecmp($value,$bye)) { unset($cart[$title]); break; } } Btw, it's => not ==>, jennifer not jannifer :) regards, Philip Olson On Thu, 27 Sep 2001, Sijan Khadka wrote: > How can we remove certain key==>val from an array? > > Lets say i have an array -- > $cart = array ( > "Software"==> "Redhat", > "Book" ==> "Mastering PHP", > "MusicCD" ==> "Jannifer Lopez" > ) ; > > Here I want to remove "MusicCD" ==> "Jannifer Lopez" such that the > $cart = > array ( "Software"==> "Redhat", "Book" ==> "Mastering > PHP") ; > > If any one understand it, then please help me... > Xtrema_netX > > > > -- > 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 >

« previous php.general (#68925) next »