从数组中获取列数据

I have an array as follows

Array
(
    [0] => Array
        (
            [route_id] => 2/2A
            [direction] => right
            [bus_stop_count] => 1
            [bus_id] => Array
                (
                    [0] => 1000
                    [1] => 1002
                )

        )

    [1] => Array
        (
            [route_id] => 1
            [direction] => right
            [bus_stop_count] => 1
            [bus_id] => Array
                (
                    [0] => 1004
                )

        )

)

I want to get an array for bus_id like the following

Array
(
    [0] => 1000
    [1] => 1002
    [2] => 1004
)

Here is what i tried so far

$bus_ids = array_column($array, 'bus_id');

Array
(
    [0] => Array
        (
            [0] => 1000
            [1] => 1002
        )

    [1] => Array
        (
            [0] => 1004
        )

)

That should work:

$a = array(...);
call_user_func_array('array_merge', array_column ($a, 'bus_id'))

You can use a for loop:

$newArr = Array();
foreach ($arr as $value) $newArr = array_merge($newArr, $value["bus_id"]);