3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Задача: проверить, строка-предложение в переменной $pangram - это настоящая панграмма или нет? * (Правда ли включает в себя каждую букву данного алфавита $alphabet хотя бы 1 раз?) * * A Pangram (Greek: παν γράμμα, pan gramma, "every letter") or holoalphabetic sentence for a given * alphabet is a sentence using every letter of the alphabet at least once. * Source: wikipedia.org https://en.wikipedia.org/wiki/Pangram */ $alphabet = "abcdefghijklmnopqrstuvwxyz"; // English alphabet $alphabet_array = str_split(strtolower($alphabet)); $pangram = strtolower("Grumpy wizards make toxic brew for the evil Queen and Jack."); // English pangram $cnt = ''; $$cnt = 0; $array = array(); while(!empty($alphabet_array)){ $cnt = array_shift($alphabet_array); $$cnt = substr_count($pangram, $cnt); if($$cnt != 0){ $array["$cnt"] = $$cnt; }else{ echo "This is not a real pangram! $cnt is not found in this sentence."; exit; } } ksort($array); echo count($alphabet_array), count($array); foreach($array as $letter=>$occurrence){ echo "$letter was used " , ($occurrence==1)?"once \n":"$occurrence times \n"; }
Output for 5.6.0 - 5.6.23, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 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
026a was used 4 times b was used once c was used 2 times d was used 2 times e was used 6 times f was used once g was used once h was used once i was used 3 times j was used once k was used 2 times l was used once m was used 2 times n was used 2 times o was used 2 times p was used once q was used once r was used 4 times s was used once t was used 2 times u was used 2 times v was used once w was used 2 times x was used once y was used once z was used once
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 026a was used 4 times b was used once c was used 2 times d was used 2 times e was used 6 times f was used once g was used once h was used once i was used 3 times j was used once k was used 2 times l was used once m was used 2 times n was used 2 times o was used 2 times p was used once q was used once r was used 4 times s was used once t was used 2 times u was used 2 times v was used once w was used 2 times x was used once y was used once z was used once

preferences:
169.88 ms | 403 KiB | 181 Q