Search in array, like select?

前端 未结 3 1751
天涯浪人
天涯浪人 2021-01-28 03:32

My array with countries is:

$cars = array(
    [\'brand\' => \'bmw\', \'place_1\' => \'Munich\', \'place_2\' => \'Cologne\'],
    [\'brand\' => \'vw\         


        
3条回答
  •  清酒与你
    2021-01-28 03:35

    Not tested but something like this

       function arraySelect($arr,$brand){
            $selection=[];
            foreach($arr as $a){
                    if($a["brand"]=$brand{
                            array_push($selection,$a);
                    }
            }
            return $selection;
    }
    

提交回复
热议问题