开发者

remove line from array by key [duplicate]

开发者 https://www.devze.com 2022-12-12 10:31 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: PHP: How to remove specific element from an array?
This question already has answers here: Closed 11 years ago.

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 [addtoc开发者_如何学Goart] => 1 part


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


$vars = array('name' => super, 'price' => 65.87, 'quantity' => 25, 'addtocart' => 1);

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

精彩评论

暂无评论...
验证码 换一张
取 消