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
Post a Comment