<?php
$array = [
['Name' => 'Opony', 'Kod' =>'OPO', 'Price' => 100],
['Kod' =>'OLE', 'Name' => 'Olej', 'Price' => 20],
['Kod' =>'ABC', 'Price' => 20, 'Name' => 'abcdefg']
];
array_walk($array, fn(&$row) => ksort($row));
var_export($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:
53.86 ms | 407 KiB | 5 Q