3v4l.org

run code in 300+ PHP versions simultaneously
<?hh /*-------------------------*\ $PROGRAM \*-------------------------*/ $zero = $f ==> $x ==> $x; $one = $f ==> $x ==> $f($x); $two = $f ==> $x ==> $f($f($x)); $three = $f ==> $x ==> $f($f($f($x))); $five = $f ==> $x ==> $f($f($f($f($f($x))))); $true = $x ==> $y ==> $x; $false = $x ==> $y ==> $y; $if = $f ==> $f; $isZero = $f ==> ($f($x ==> $false))($true); $increment = $n ==> $f ==> $x ==> $f(($n($f))($x)); $decrement = $n ==> $f ==> $x ==> (($n($g ==> $h ==> $h($g($f))))($y ==> $x))($y ==> $y); $add = $m ==> $n ==> ($n($increment))($m); $subtract = $m ==> $n ==> ($n($decrement))($m); $multiply = $m ==> $n ==> ($n($add($m)))($zero); $power = $m ==> $n ==> ($n($multiply($m)))($one); $cons = $x ==> $y ==> $f ==> ($f($x))($y); $car = $p ==> $p($x ==> $y ==> $x); $cdr = $p ==> $p($x ==> $y ==> $y); /*-------------------------*\ $DISPLAY HELPERS \*-------------------------*/ $toNum = $f ==> ($f($x ==> $x + 1))(0); $toBool = $f ==> (($if($f))(true))(false); $toTextBool = $f ==> $toBool($f) ? 'true' : 'false'; function it($m,$p){echo "\033[".($p?"32m✔":"31m✘")." It $m\033[0m\n"; if(!$p)register_shutdown_function(function(){die(1);});} /*-------------------------*\ $TESTS \*-------------------------*/ it('has zero', $toNum($zero) === 0); it('has one', $toNum($one) === 1); it('has two', $toNum($two) === 2); it('has three', $toNum($three) === 3); it('has five', $toNum($five) === 5); it('has true', $toBool($true) === true); it('has false', $toBool($false) === false); it('can find zero values', $toBool($isZero($zero)) === true); it('can find non zero values', $toBool($isZero($three)) === false); it('can increment values', $toNum($increment($one)) === 2); it('can decrement values', $toNum($increment($three)) === 2); it('can add numbers', $toNum(($add($three))($one)) === 4); it('can subtract numbers', $toNum(($subtract($five))($two)) === 3); it('can multiply numbers', $toNum(($multiply($five))($three)) === 15); it('can calculate the power of numbers', $toNum(($power($three))($three)) === 27); $list = ($cons($one))($two); it('can find the car of a list', $toNum($car($list)) === 1); it('can find the cdr of a list', $toNum($cdr($list)) === 2); $bigList = ($cons($one))(($cons($two))($three)); it('can find the car of a big list', $toNum($car($bigList)) === 1); it('can find the cdar of a big list', $toNum($car($cdr($bigList))) === 2); it('can find the cddr of a big list', $toNum($cdr($cdr($bigList))) === 3);

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)
8.3.60.0100.01016.63
8.3.50.0140.00019.88
8.3.40.0100.01018.59
8.3.30.0110.00318.66
8.3.20.0080.00020.13
8.3.10.0000.00821.68
8.3.00.0000.00817.25
8.2.180.0130.00716.32
8.2.170.0120.00322.96
8.2.160.0100.01020.38
8.2.150.0080.00024.18
8.2.140.0090.00024.66
8.2.130.0000.00826.16
8.2.120.0040.00420.96
8.2.110.0030.00622.19
8.2.100.0080.00317.78
8.2.90.0050.00319.09
8.2.80.0000.00817.97
8.2.70.0100.00017.25
8.2.60.0040.00417.91
8.2.50.0030.00618.07
8.2.40.0040.00417.97
8.2.30.0070.00017.83
8.2.20.0000.00817.45
8.2.10.0040.00417.82
8.2.00.0040.00417.52
8.1.280.0100.01025.92
8.1.270.0040.00423.79
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0000.00923.71
8.1.230.0100.00019.22
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0030.00617.10
8.1.190.0050.00316.88
8.1.180.0030.00618.86
8.1.170.0040.00418.58
8.1.160.0050.00221.93
8.1.150.0000.00718.77
8.1.140.0040.00417.18
8.1.130.0030.00317.61
8.1.120.0000.00717.36
8.1.110.0040.00417.23
8.1.100.0000.00717.31
8.1.90.0040.00317.31
8.1.80.0000.00717.31
8.1.70.0040.00417.33
8.1.60.0000.00817.45
8.1.50.0050.00317.32
8.1.40.0040.00417.29
8.1.30.0030.00517.38
8.1.20.0000.00917.34
8.1.10.0050.00317.26
8.1.00.0030.00617.38
8.0.300.0070.00018.77
8.0.290.0040.00416.75
8.0.280.0080.00018.29
8.0.270.0000.00817.11
8.0.260.0030.00317.05
8.0.250.0000.00716.82
8.0.240.0040.00416.81
8.0.230.0000.00616.86
8.0.220.0000.00716.78
8.0.210.0000.00716.80
8.0.200.0090.00016.80
8.0.190.0000.00816.79
8.0.180.0040.00416.69
8.0.170.0000.00816.68
8.0.160.0030.00316.69
8.0.150.0000.00716.70
8.0.140.0070.00416.67
8.0.130.0000.00513.41
8.0.120.0040.00416.73
8.0.110.0040.00416.80
8.0.100.0030.00316.57
8.0.90.0030.00316.79
8.0.80.0140.00716.74
8.0.70.0070.00016.78
8.0.60.0080.00016.63
8.0.50.0050.00216.80
8.0.30.0130.00616.96
8.0.20.0120.00717.40
8.0.10.0000.00716.68
8.0.00.0140.00516.59
7.4.330.0020.00215.09
7.4.320.0000.00616.45
7.4.300.0000.00616.45
7.4.290.0030.00316.42
7.4.280.0030.00516.35
7.4.270.0030.00316.38
7.4.260.0030.00616.45
7.4.250.0070.00016.45
7.4.240.0020.00516.42
7.4.230.0040.00416.36
7.4.220.0100.00716.43
7.4.210.0130.01016.54
7.4.200.0070.00016.46
7.4.160.0090.00916.47
7.4.150.0030.01317.40
7.4.140.0100.00917.86
7.4.130.0100.00616.25
7.4.120.0120.00716.37
7.4.110.0150.00316.45
7.4.100.0120.01216.36
7.4.90.0170.00316.13
7.4.80.0090.01319.39
7.4.70.0140.01016.49
7.4.60.0070.01116.23
7.4.50.0040.00416.36
7.4.40.0110.00716.44
7.4.30.0090.00916.40
7.3.330.0050.00013.07
7.3.320.0050.00013.18
7.3.310.0000.00716.07
7.3.300.0030.00316.03
7.3.290.0030.01016.17
7.3.280.0100.00516.19
7.3.270.0100.01317.40
7.3.260.0130.00316.29
7.3.250.0080.01016.32
7.3.240.0130.00316.32
7.3.230.0070.01016.39
7.3.210.0100.01316.20
7.3.200.0170.00519.39
7.3.190.0030.01316.33
7.3.180.0080.00816.02
7.3.170.0060.01016.27
7.3.160.0120.00516.58
7.2.330.0100.00716.43
7.2.320.0100.00716.65
7.2.310.0100.00716.41
7.2.300.0070.01016.54
7.2.290.0000.01616.30
5.5.150.0970.05320.27
5.5.140.0930.05020.12
5.5.130.0730.05320.21
5.5.120.0100.05320.30
5.5.110.1130.05720.11
5.5.100.1130.05320.16
5.5.90.1070.05720.16
5.5.80.1130.07020.22
5.5.70.0970.06720.20
5.5.60.1100.05020.21
5.5.50.1170.08020.02
5.5.40.1400.07320.20
5.5.30.1030.05320.07
5.5.20.0900.07020.09
5.5.10.1070.06720.03
5.5.00.1100.05720.02
5.4.310.0930.05719.18
5.4.300.0870.06018.84
5.4.290.1100.04319.11
5.4.280.0100.05319.19
5.4.270.0930.06719.29
5.4.260.1100.06019.00
5.4.250.1130.05319.30
5.4.240.1000.03719.00
5.4.230.1100.05019.02
5.4.220.1070.05719.26
5.4.210.0900.06019.18
5.4.200.1170.08019.21
5.4.190.1300.07019.25
5.4.180.1030.05319.15
5.4.170.0770.06019.20
5.4.160.0970.05019.27
5.4.150.0730.07019.15
5.4.140.0930.04716.34
5.4.130.1000.06016.45
5.4.120.1030.06316.25
5.4.110.1130.05716.43
5.4.100.1030.06016.50
5.4.90.0970.05016.53
5.4.80.0870.06316.38
5.4.70.0830.05316.52
5.4.60.0900.05016.47
5.4.50.1070.04716.36
5.4.40.1130.04716.59
5.4.30.0870.05716.55
5.4.20.1270.06316.39
5.4.10.1030.05716.37
5.4.00.1030.04315.70

preferences:
59.57 ms | 400 KiB | 5 Q