i have this multidimensional array.
Array
(
[0] => Array
(
[car] => Toyota
)
[1] => Array
(
[car] => Ford
)
[2] => Array
(
[car] => Isuzu
)
[3] => Array
(
[car] => Chevrolet
)
)
i want to put them into indexed array like this..
Array = ("Toyota", "Ford", "Isuzu", "Chevrolet");
foreach($yourArray as $carArray)
{
$result[]=$carArray["car"];
}
And your understanding of indexed arrays
is wrong. That example output you've shown contains all those values, not indexes, and since you didn't specify an index it will start from 0 and so on.
Option using array_map(), assuming your initial array is $arr
$new_arr = array_map(function($x){return $x['car'];}, $arr);
$result = array_map(function($item)
{ return $item['car']; }, $array);
Some functional approach. array_map
P.S. PHP has no indexed arrays
try using foreach and array_values, then save it into empty array. Hope it helps.