3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrTags = [ 'mango' => 2, 'orange' => 4, 'apple' => 2, 'banana' => 3, 'peach' => 3, 'strawberry' => 3, 'blueberry' => 3, 'raspberry' => 3, 'lychee' => 2, 'fig' => 1, 'guava' => 1, 'grape' => 3, 'watermelon' => 2, 'kiwi' => 5, 'pear' => 3 ]; uksort($arrTags, fn($a, $b) => [$arrTags[$b], $a] <=> [$arrTags[$a], $b]); var_export($arrTags);
Output for 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.27, 8.4.1 - 8.4.14
array ( 'kiwi' => 5, 'orange' => 4, 'banana' => 3, 'blueberry' => 3, 'grape' => 3, 'peach' => 3, 'pear' => 3, 'raspberry' => 3, 'strawberry' => 3, 'apple' => 2, 'lychee' => 2, 'mango' => 2, 'watermelon' => 2, 'fig' => 1, 'guava' => 1, )
Output for 7.3.0 - 7.3.33
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')' in /in/V6N68 on line 21
Process exited with code 255.

preferences:
320.79 ms | 407 KiB | 5 Q