php - Make a simple array from a complex array -


i have array ($query) database:

array ( [0] => array     (         [category] => mercedes     )  [1] => array     (         [category] => bmw     )  [2] => array     (         [category] => bentley     )  ) 

i want make array $category:

array (     [0] => mercedes     [1] => bmw     [2] => bentley ) 

i tried array_merge() result doesn't want.

you have iterate on array, pick each 'category' value.

foreach ($query $array) {     $newarray[] = $array['category']; } 

$newarray contain values require.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -