php-PHP如何给这个数组里增加内容
程序员文章站
2022-04-12 16:18:17
...
php数组
$brandData = array(
array('id'=> 1,'value'=> 388, "name"=> "品牌1","type"=>"brand"),
array("id"=> 2,"value"=> 205, "name"=> "品牌2","type"=>"brand"),
array("id"=> 3,"value"=> 215, "name"=> "品牌3","type"=>"brand"),
);
页面上会传递brand的value值
我想根据传递过来的值给相应的数组增加下面这个内容
,"selected"=>1
例如: array('id'=> 1,'value'=> 388, "name"=> "品牌1","type"=>"brand","selected"=>1),