Convert multidimensional array into single array

This single line would do that:

$array = array_column($array, 'plan');

The first argument is an array | The second argument is an array key.

For details, go to official documentation: https://www.php.net/manual/en/function.array-column.php.

Leave a Comment