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"; }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.0.80.1300.06719.89
7.0.70.0300.07319.89
7.0.60.0300.07019.98
7.0.50.0370.06320.38
7.0.40.0730.07320.36
7.0.30.1100.08020.32
7.0.20.1030.07020.34
7.0.10.0370.05720.40
7.0.00.0530.08720.33
5.6.230.0070.07320.75
5.6.220.0130.06020.58
5.6.210.0130.09720.49
5.6.200.0130.06321.08
5.6.190.0170.07021.09
5.6.180.0170.08021.20
5.6.170.0170.07021.13
5.6.160.0130.06721.06
5.6.150.0170.07321.13
5.6.140.0170.05721.08
5.6.130.0200.05721.04
5.6.120.0070.08321.08
5.6.110.0130.07321.16
5.6.100.0300.07321.14
5.6.90.0200.08021.12
5.6.80.0270.04720.46
5.6.70.0130.06320.52
5.6.60.0130.06020.47
5.6.50.0100.07020.52
5.6.40.0200.06720.51
5.6.30.0230.06020.46
5.6.20.0170.07320.38
5.6.10.0170.08320.48
5.6.00.0270.06720.42

preferences:
144.52 ms | 1394 KiB | 7 Q