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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to