php - array switch case statement -
i have array coming in sub arrays this
array ( [0] => array ( [customers] => array ( [id] => ) [products] => array ( [id] => ) [models] => array ( [id] => 151 [submodels] => array ( [ol] => ) [noice] => ) )
i want make switch statement on array
so this
switch($array){ case products: case customers: case models: }
how that. thanks
since $array holds array within it, looks you'll want @ keys of array indexed @ $array[0]
foreach ($array[0] $key => $value) { switch ($key) { case 'products' : // break ; case 'customers' : // break ; case 'models' : // break ; } }
Comments
Post a Comment