3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ifAllElseFails($type, $msg, $file, $line, $context) { echo ( "Ah what the hell. Doesn't work. But the meaning of life is 42. And chickens or eggs? Nah. It was a mutant gecko." ); } error_reporting(E_ALL); set_error_handler("ifAllElseFails"); class TheMeaningOfLif { var $came_first; var $the_answer; var $aeons; var $doubt; var $uncertainty; function TheMeaningOfLif() { $this->aeons = "150"; $this->doubt = ceil ( 13.3 * $this->Life() ); $this->uncertainty = floor ( 132 / $this->theUniverse() ); $this->the_answer[whatisthemeaning] = $this->andEverything(); $this->came_first = array ( "The Chicken", "The Egg" ); $this->came_first = arsort ( $this->came_first, SORT_NUMERIC ); $this->the_answer[whichcamefirst] = whichCameFirst($this->came_first); } function Life () { for ($x = 1; $x <= $this->aeons; $x++) { $r = 1 / ($x * $x); $s += $r; } $var = sqrt(6 * $s); return ( $var ); } function theUniverse () { $dw = 1; $l = 1; $up = 2; $var = 4; for ($x = 2; $x <= $var; $x++) { $l++; if ($l % 2 != 0) $up = $x + 1; elseif ($l % 2 == 0) $dw += 2; $var = $var * ($up/$dw); if ($l == 4) $l = 0; } return ( $var ); } function andEverything () { $carry = $this->doubt & $this->uncertainty; do { $carry = $carry << 1; $num1 = $this->doubt ^ $this->uncertainty; $sum = $this->doubt ^ $carry; $num2 = $carry; $carry = $this->doubt & $this->uncertainty; } while($carry != 0); return ( $carry ); } function whichCameFirst(&$arr) { function reverse_splice(&$splice, $i1, $i2) { if($i1>$i2) { $swp = $i1; $i1 = $i2; $i2 = $swp; } for($k=$i2;$k>=$i1;$k--){ $tmpArr[] = $splice[$k]; } for($k=0;$k<count($tmpArr);$k++) { $splice[$i1+$k] = $tmpArr[$k]; } } $i = count($arr); mt_srand((double)microtime()*1000000); while($i>0) { --$i; $j = @mt_rand(0, $i); if($i!=$j) { reverse_splice($arr, $i, $j); } } } function theGuruSays () { return ( $this->the_answer ); } } $TheMeaningOfLif = new TheMeaningOfLif; $the_answer = $TheMeaningOfLif->theGuruSays(); $var = $$the_answer[0]; $var = $$the_answer[1]; echo ( "The meaning of life is " . $whatisthemeaning . "<br>"); echo ( "Which came first? " . $whichcamefirst . " of course!");

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)
5.4.280.0102.48719.05
5.4.270.0102.49018.93
5.4.260.0032.49319.19
5.4.250.0032.49319.05
5.4.240.0102.48719.03
5.4.230.0132.48319.04
5.4.220.0102.48719.05
5.4.210.0072.49018.95
5.4.200.0072.49018.83
5.4.190.0102.49018.94
5.4.180.0132.48319.25
5.4.170.0072.49019.00
5.4.160.0102.48719.00
5.4.150.0102.48719.25
5.4.140.0032.49316.68
5.4.130.0172.48016.44
5.4.120.0102.48716.34
5.4.110.0172.48016.58
5.4.100.0072.49016.59
5.4.90.0032.49316.46
5.4.80.0102.48716.55
5.4.70.0072.49016.44
5.4.60.0102.48716.54
5.4.50.0032.49316.44
5.4.40.0102.48716.53
5.4.30.0032.49316.37
5.4.20.0132.48316.34
5.4.10.0072.49016.41
5.4.00.0072.49015.78
5.3.280.0032.49314.55
5.3.270.0072.49014.56
5.3.260.0072.49014.61
5.3.250.0072.49014.39
5.3.240.0072.49014.47
5.3.230.0072.49014.40
5.3.220.0072.49014.43
5.3.210.0132.48314.40
5.3.200.0072.49014.37
5.3.190.0032.49314.45
5.3.180.0132.48714.43
5.3.170.0002.49714.56
5.3.160.0132.48314.44
5.3.150.4032.09314.51
5.3.140.0102.48714.48
5.3.130.0072.49014.41
5.3.120.0072.49014.32
5.3.110.0102.48714.34
5.3.100.0132.48313.98
5.3.90.0002.49713.83
5.3.80.0032.49313.80
5.3.70.3002.19713.96
5.3.60.0102.48713.75
5.3.50.0172.48013.77
5.3.40.0102.48713.68
5.3.30.0102.48713.71
5.3.20.0132.48713.48
5.3.10.0032.49313.46
5.3.00.3572.13713.53

preferences:
35.3 ms | 401 KiB | 5 Q