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.8
Parse error: syntax error, unexpected ')', expecting ',' or ';' in /in/8vefS on line 33
Process exited with code 255.

preferences:
175.67 ms | 1395 KiB | 40 Q