3v4l.org

run code in 300+ PHP versions simultaneously
<?php $testStrings = [ "H3||0", "Hallo", "aloha", "h", "hallo", "hallå", "hel", "helicopter", "hellacious", "hello", "hello y'all", "hello yall", "helów", "hey hello", "hola", "hêllo", "mellow yellow", "try", ]; $needle = 'hello'; usort($testStrings, function($a, $b) use ($needle) { return similar_text($needle, $b) <=> similar_text($needle, $a); }); var_export($testStrings);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
array ( 0 => 'hellacious', 1 => 'hello', 2 => 'hello y\'all', 3 => 'hello yall', 4 => 'hey hello', 5 => 'hallo', 6 => 'helicopter', 7 => 'hêllo', 8 => 'mellow yellow', 9 => 'Hallo', 10 => 'hallå', 11 => 'hel', 12 => 'helów', 13 => 'aloha', 14 => 'hola', 15 => 'h', 16 => 'H3||0', 17 => 'try', )
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 array ( 0 => 'hellacious', 1 => 'hello', 2 => 'hello y\'all', 3 => 'hello yall', 4 => 'hey hello', 5 => 'hallo', 6 => 'helicopter', 7 => 'hêllo', 8 => 'mellow yellow', 9 => 'Hallo', 10 => 'hallå', 11 => 'hel', 12 => 'helów', 13 => 'aloha', 14 => 'hola', 15 => 'h', 16 => 'H3||0', 17 => 'try', )
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
array ( 0 => 'hellacious', 1 => 'hello', 2 => 'hello y\'all', 3 => 'hello yall', 4 => 'hey hello', 5 => 'mellow yellow', 6 => 'hallo', 7 => 'helicopter', 8 => 'hêllo', 9 => 'hallå', 10 => 'hel', 11 => 'Hallo', 12 => 'helów', 13 => 'aloha', 14 => 'hola', 15 => 'h', 16 => 'H3||0', 17 => 'try', )

preferences:
192.58 ms | 402 KiB | 182 Q