tags:

views:

33

answers:

2

How can i remove a line from an array where the key name = a given target...such as

[name] => super [price] => 65.87 [quantity] => 25 [addtocart] => 1

say i wanted to remove the [addtocart] => 1 part

+2  A: 

I believe you want to unset($arr['addtocart']);

meder
@meder - sorry for the retarded edit, don't know where my brain was at.
karim79
that simple eh?
Patrick
@karim79 - no problem, I do it all the time... its late too@Patrick - yeah - that's it.
meder
@karim79 - thanks for giving me my first cleanup badge :)
meder
+1  A: 
$vars = array('name' => super, 'price' => 65.87, 'quantity' => 25, 'addtocart' => 1);

unset($vars['addtocart']);
dfilkovi