Open
Description
Description
The following code:
<?php
$arr = [
'2023-02-04 14:00:00',
'2023-01-08 12:00:00',
'2023-01-03 12:00:00',
'2023-01-03 12:00:00',
'2021-01-03 12:00:00',
'2023-01-05 14:00:00',
'2024-01-03 12:00:00',
'2023-01-03 12:00:00',
];
$coll = Collator::create('de');
$coll->asort($arr, Collator::SORT_REGULAR);
echo json_encode($arr, JSON_PRETTY_PRINT);
Resulted in this output:
{
"4": "2021-01-03 12:00:00",
"0": "2023-02-04 14:00:00",
"1": "2023-01-08 12:00:00",
"2": "2023-01-03 12:00:00",
"3": "2023-01-03 12:00:00",
"5": "2023-01-05 14:00:00",
"7": "2023-01-03 12:00:00",
"6": "2024-01-03 12:00:00"
}%
But I expected this output instead:
{
"4": "2021-01-03 12:00:00",
"2": "2023-01-03 12:00:00",
"3": "2023-01-03 12:00:00",
"7": "2023-01-03 12:00:00",
"5": "2023-01-05 14:00:00",
"1": "2023-01-08 12:00:00",
"0": "2023-02-04 14:00:00",
"6": "2024-01-03 12:00:00"
}
PHP Version
Since the dawn of time up to 8.4.7 apparently introduced in PHP6(!)
Operating System
any