<?php
$array1 = [
"3" => "aBc",
"ab" => "abc12",
"lkT" => 2,
"65" => "Abc",
45 => "test",
"This" => "is this",
"2" => "abc",
false => "abc012",
" " => 22.22,
];
$array2 = [
"5" => "abc",
"2" => "bca",
"1" => "?",
"33" => "he11o",
];
print_r($array1);
print_r($array2);
array_multisort($array1, SORT_ASC, SORT_NUMERIC,
$array2, SORT_DESC, SORT_NATURAL
);
print_r($array1);
print_r($array2);
- Output for 8.2.0 - 8.2.26, 8.3.0 - 8.3.14, 8.4.1 - 8.4.2
- Array
(
[3] => aBc
[ab] => abc12
[lkT] => 2
[65] => Abc
[45] => test
[This] => is this
[2] => abc
[0] => abc012
[ ] => 22.22
)
Array
(
[5] => abc
[2] => bca
[1] => ?
[33] => he11o
)
Fatal error: Uncaught ValueError: Array sizes are inconsistent in /in/u0Ft0:24
Stack trace:
#0 /in/u0Ft0(24): array_multisort(Array, 4, 1, Array, 3, 6)
#1 {main}
thrown in /in/u0Ft0 on line 24
Process exited with code 255. - Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.31
- Array
(
[3] => aBc
[ab] => abc12
[lkT] => 2
[65] => Abc
[45] => test
[This] => is this
[2] => abc
[0] => abc012
[ ] => 22.22
)
Array
(
[5] => abc
[2] => bca
[1] => ?
[33] => he11o
)
Fatal error: Uncaught ValueError: Array sizes are inconsistent in /in/u0Ft0:25
Stack trace:
#0 /in/u0Ft0(25): array_multisort(Array, 4, 1, Array, 3, 6)
#1 {main}
thrown in /in/u0Ft0 on line 25
Process exited with code 255. - Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
- Array
(
[3] => aBc
[ab] => abc12
[lkT] => 2
[65] => Abc
[45] => test
[This] => is this
[2] => abc
[0] => abc012
[ ] => 22.22
)
Array
(
[5] => abc
[2] => bca
[1] => ?
[33] => he11o
)
Warning: array_multisort(): Array sizes are inconsistent in /in/u0Ft0 on line 25
Array
(
[3] => aBc
[ab] => abc12
[lkT] => 2
[65] => Abc
[45] => test
[This] => is this
[2] => abc
[0] => abc012
[ ] => 22.22
)
Array
(
[5] => abc
[2] => bca
[1] => ?
[33] => he11o
)
preferences:
52.25 ms | 411 KiB | 5 Q