3v4l.org

run code in 300+ PHP versions simultaneously
<?php $resultSet = [ ['year' => 2013, 'month' => 6, 'total_count' => 529], ['year' => 2013, 'month' => 7, 'total_count' => 550], ['year' => 2013, 'month' => 8, 'total_count' => 1005], ['year' => 2013, 'month' => 9, 'total_count' => 1021], ['year' => 2013, 'month' => 10, 'total_count' => 1027], ]; $result = []; foreach ($resultSet as $row) { $result[] = [ date('M y', strtotime($row['year'] . '-' . $row['month'])), $row['total_count'] ]; } echo json_encode($result, JSON_PRETTY_PRINT);

preferences:
26.93 ms | 406 KiB | 5 Q