3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = ['A', 'BBB', 'CC', 'DD', 'E', 'FF', 'G']; uasort($arr, fn ($a, $b) => strlen($a) <=> strlen($b)); var_export($arr);
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.14
array ( 0 => 'A', 4 => 'E', 6 => 'G', 2 => 'CC', 3 => 'DD', 5 => 'FF', 1 => 'BBB', )

preferences:
48.51 ms | 406 KiB | 5 Q