<?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);
- Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.4, 8.3.6 - 8.3.25, 8.4.1 - 8.4.13
- [
[
"Jun 13",
529
],
[
"Jul 13",
550
],
[
"Aug 13",
1005
],
[
"Sep 13",
1021
],
[
"Oct 13",
1027
]
]
- Output for 8.3.5
- Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[
[
"Jun 13",
529
],
[
"Jul 13",
550
],
[
"Aug 13",
1005
],
[
"Sep 13",
1021
],
[
"Oct 13",
1027
]
]
preferences:
160.89 ms | 408 KiB | 5 Q