3v4l.org

run code in 300+ PHP versions simultaneously
<?php <?php /** * Ask santa for less fugly code next year * * Happy new year from Ignas:) */ //Open alternate window fwrite(STDOUT, "\0337\033[?47h"); $top = " | \\ ' / "; $base = " >*< >O<@< >>>@<<* >@>*<O<<< >*>>@<<<@<< >@>>O<<<*<<@< >*>>O<<@<<<@<<< >@>>*<<@<>*<<O<*< >O>>*<<@<>O><<*<@<< >*>>@><O<<*>>@><*<O<< >@>>O<*<O>>@<<O<<<*<@<< >O>>*<<@>O><*<O><@<<<O<*< | | | | /___\ "; /** * Add sparkling top * * @param $top * @param int $size * @return string */ function sparkleTop($top, $size = 1) { $topLight = '- (@) -'; $topLight = str_repeat(' ', 5 - $size) . preg_replace('/-{1,}/', str_repeat('-', $size), $topLight); $top = $top . $topLight; return $top; } /** * Switch toys to add animation * * @param $tree * @param bool|false $reverse * @return string */ function switchToys($tree, $reverse = false) { $replace = ["*" => "@", "@" => "*"]; if ($reverse) { $replace = array_flip($replace); } $tree = strtr($tree, $replace); return $tree; } /** * Color text * * @param $text * @param $color * @return string */ function color($text, $color) { $colors = [ 'red' => "\033[31m", 'green' => "\033[32m", 'yellow' => "\033[33m" ]; $end = "\033[0m"; $text = $colors[$color] . $text . $end; return $text; } // color all <> symbols green $base = str_replace( ['<', '>'], [ color('<', 'green'), color('>', 'green') ], $base ); $reverse = true; $iteration = 0; // animate it all while (true) { $reverse = !$reverse; // clear screen fwrite(STDOUT, "\033[H\033[2J"); $output = $base; if ($iteration % 3 === 0) { $base = switchToys($base, $reverse); $iteration = 0; } // color toys $output = str_replace('*', color('*', 'red'), $base); $output = str_replace('@', color('@', 'yellow'), $output); $topping = sparkleTop($top, $iteration); $output = $topping . $output; $iteration++; echo $output; usleep(500000); } ?>

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.10.0130.07320.07
7.0.00.0070.07020.24
5.6.160.0030.05320.47
5.6.150.0070.07018.22
5.6.140.0070.03318.17
5.6.130.0100.04318.15
5.6.120.0030.04321.02
5.6.110.0070.03721.04
5.6.100.0030.04020.93
5.6.90.0100.07720.98
5.6.80.0000.06020.40
5.5.300.0030.04017.98
5.5.290.0100.06318.09
5.5.280.0070.04020.68
5.5.270.0070.05320.95
5.5.260.0030.08020.86
5.5.250.0130.07720.68
5.5.240.0170.06720.32

preferences:
144.53 ms | 1394 KiB | 7 Q