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 git.master, git.master_jit, rfc.property-hooks
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

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
69.6 ms | 402 KiB | 8 Q