Skip to content
Advertisement

Split assoc array by keys

I have data like this:

JavaScript

I want to separate it into 3 different arrays like so:

JavaScript

For the life of me i just cant seem to wrap my head around this today, I have tried doing loops and while/if using “array_colum()” but I cant get to add a 0 for the entry that does not have a matching date.

PS: I need the data in that format snice im charting it on chart.js within a Laravel view.

Any help is greatly appreciated.

Advertisement

Answer

JavaScript

This will print:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement