3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['Name' => 'Opony', 'Kod' =>'OPO', 'Price' => 100], ['Kod' =>'OLE', 'Name' => 'Olej', 'Price' => 20], ['Kod' =>'ABC', 'Price' => 20, 'Name' => 'abcdefg'] ]; function keySortRow(array $row): array { ksort($row); return $row; } var_export( array_map('keySortRow', $array) );
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
array ( 0 => array ( 'Kod' => 'OPO', 'Name' => 'Opony', 'Price' => 100, ), 1 => array ( 'Kod' => 'OLE', 'Name' => 'Olej', 'Price' => 20, ), 2 => array ( 'Kod' => 'ABC', 'Name' => 'abcdefg', 'Price' => 20, ), )

preferences:
72.89 ms | 407 KiB | 5 Q