score:1

Accepted answer

It's pretty straight forward. Just create an array in PHP with the same leves and keys:

$data = [
    '2016' => [
        [
            "date"  => "2016/01/01",
            "close" =>  837
        ],
        [
            "date"  => "2016/12/01",
            "close" => 769
        ],
    ],    
    '2015' => [
        [
            "date"  => "2015/01/01",
            "close" => 637
        ],
        [
            "date"  => "2015/12/01",
            "close" => 669
        ],
    ],    
    // ... and so on
];

Demo: https://3v4l.org/cfHqs


Related Query

More Query from same tag