I have an array which consists of statistics pulled from my database. Each inner array has a key based on where it come from. I want to group all these together in a new array.
array (
0 =>
array (
7 =>
array (
'y' => 83,
'label' => '2019-01-04 00:00:00',
),
),
1 =>
array (
7 =>
array (
'y' => 80,
'label' => '2019-01-02 00:00:00',
),
),
2 =>
array (
8 =>
array (
'y' => 50,
'label' => '2019-01-03 00:00:00',
),
),
)
Would look like this:
array (
0 =>
array(
0 =>
array(
'y' => 83,
'label' => '2019-01-04 00:00:00',
),
1 =>
array(
'y' => 80,
'label' => '2019-01-02 00:00:00',
),
),
1 =>
array(
0 =>
array(
'y' => 50,
'label' => '2019-01-03 00:00:00',
),
),
)
However, I cannot seem to use array_values() to achieve this. I want to group all of the 7's into an array and all of the 8's into an array however, I could have more numeric keys in the future.
Is there a function I can use to do this?
json_encodeing the data and the graph API I am using expects no keys in the array @trincot