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
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
2 matches
Mail list logo