3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "A very nice únÌcÕdë text. Something nice to think Something about if you're into Unicode."; $words = str_word_count($text, 1); // use this function if you only want ASCII $frequency = array_count_values($words); arsort($frequency); $myJSON = json_encode($frequency); print_r($myJSON);
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 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
{"nice":2,"Something":2,"A":1,"very":1,"n":1,"c":1,"d":1,"text":1,"to":1,"think":1,"about":1,"if":1,"you're":1,"into":1,"Unicode":1}
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 {"nice":2,"Something":2,"A":1,"very":1,"n":1,"c":1,"d":1,"text":1,"to":1,"think":1,"about":1,"if":1,"you're":1,"into":1,"Unicode":1}
Output for 5.6.0 - 5.6.40
{"nice":2,"Something":2,"if":1,"about":1,"you're":1,"into":1,"Unicode":1,"think":1,"to":1,"c":1,"n":1,"d":1,"text":1,"A":1,"very":1}

preferences:
222.73 ms | 401 KiB | 288 Q