2

Possible Duplicate:
PHP: How to remove specific element from an array?

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

0

2 Answers 2

4

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

Sign up to request clarification or add additional context in comments.

3 Comments

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

unset($vars['addtocart']);

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.