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 ($p?"✔":"✘")." It $m\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($decrement($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.0180.00316.75
8.3.50.0100.00822.93
8.3.40.0000.01918.54
8.3.30.0100.00318.96
8.3.20.0000.00820.21
8.3.10.0050.00321.60
8.3.00.0090.00017.25
8.2.180.0110.01116.38
8.2.170.0070.00722.96
8.2.160.0070.01020.27
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0060.00926.16
8.2.120.0070.00021.08
8.2.110.0100.00020.35
8.2.100.0080.00317.59
8.2.90.0060.00319.57
8.2.80.0040.00417.97
8.2.70.0060.00317.25
8.2.60.0000.00817.89
8.2.50.0060.00318.07
8.2.40.0040.00418.22
8.2.30.0070.00017.97
8.2.20.0040.00417.55
8.2.10.0000.00717.87
8.2.00.0040.00417.46
8.1.280.0070.00725.92
8.1.270.0040.00423.89
8.1.260.0000.00726.35
8.1.250.0070.00028.09
8.1.240.0090.00022.61
8.1.230.0120.00020.89
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0060.00317.23
8.1.190.0040.00417.00
8.1.180.0040.00418.88
8.1.170.0080.00018.37
8.1.160.0000.00721.93
8.1.150.0050.00318.73
8.1.140.0000.00717.22
8.1.130.0030.00319.53
8.1.120.0000.00717.31
8.1.110.0040.00417.30
8.1.100.0050.00217.25
8.1.90.0000.00717.27
8.1.80.0070.00017.31
8.1.70.0000.00717.17
8.1.60.0040.00417.40
8.1.50.0000.00817.32
8.1.40.0040.00417.38
8.1.30.0030.00617.49
8.1.20.0070.00017.48
8.1.10.0000.00717.40
8.1.00.0030.00517.36
8.0.300.0000.00819.83
8.0.290.0000.00816.75
8.0.280.0030.00318.38
8.0.270.0000.00717.29
8.0.260.0030.00317.18
8.0.250.0030.00316.79
8.0.240.0070.00016.71
8.0.230.0040.00416.80
8.0.220.0030.00316.70
8.0.210.0000.00716.77
8.0.200.0100.00016.73
8.0.190.0040.00416.83
8.0.180.0040.00416.70
8.0.170.0040.00416.79
8.0.160.0030.00316.70
8.0.150.0030.00316.75
8.0.140.0030.00616.72
8.0.130.0030.00313.34
8.0.120.0050.00316.73
8.0.110.0000.00716.64
8.0.100.0000.00716.75
8.0.90.0070.00016.75
8.0.80.0080.00616.77
8.0.70.0030.00516.79
8.0.60.0000.00716.61
8.0.50.0040.00416.79
8.0.30.0060.01217.04
8.0.20.0130.00517.40
8.0.10.0070.00016.88
8.0.00.0050.01216.54
7.4.330.0050.00015.01
7.4.320.0030.00316.47
7.4.300.0030.00316.32
7.4.290.0030.00316.38
7.4.280.0040.00416.44
7.4.270.0070.00016.41
7.4.260.0030.00316.34
7.4.250.0000.00816.32
7.4.240.0040.00416.42
7.4.230.0070.00016.55
7.4.220.0080.00816.52
7.4.210.0000.01416.49
7.4.200.0030.00316.26
7.4.160.0140.00716.50
7.4.150.0080.01217.40
7.4.140.0080.00917.86
7.4.130.0050.01116.32
7.4.120.0080.00816.38
7.4.110.0110.00816.31
7.4.100.0150.00316.30
7.4.90.0170.00616.16
7.4.80.0100.00719.39
7.4.70.0130.00716.30
7.4.60.0030.01316.20
7.4.50.0030.00616.43
7.4.40.0060.00916.39
7.4.30.0090.00916.18
7.3.330.0000.00612.99
7.3.320.0050.00012.95
7.3.310.0050.00216.06
7.3.300.0000.00716.11
7.3.290.0060.01216.08
7.3.280.0080.00816.11
7.3.270.0110.00617.40
7.3.260.0090.00916.22
7.3.250.0110.00616.29
7.3.240.0080.00816.29
7.3.230.0160.00416.39
7.3.210.0090.00916.53
7.3.200.0100.01319.39
7.3.190.0070.01016.16
7.3.180.0060.00916.32
7.3.170.0140.00316.45
7.3.160.0060.00916.36
7.2.330.0120.01116.59
7.2.320.0090.01316.20
7.2.310.0090.00916.68
7.2.300.0120.00416.22
7.2.290.0060.00916.27
5.5.150.0900.05720.18
5.5.140.1170.05020.27
5.5.130.0930.05320.29
5.5.120.0900.06020.23
5.5.110.0930.06020.20
5.5.100.1000.05319.99
5.5.90.0930.05320.16
5.5.80.0930.06320.17
5.5.70.0900.04719.99
5.5.60.0270.04720.14
5.5.50.1270.06720.16
5.5.40.1130.06019.99
5.5.30.1070.06320.20
5.5.20.1070.04320.13
5.5.10.1070.07320.13
5.5.00.1130.06320.04
5.4.310.0830.05719.09
5.4.300.0970.05019.27
5.4.290.0930.05719.27
5.4.280.0900.06319.16
5.4.270.0970.05019.19
5.4.260.0970.05719.10
5.4.250.1030.04319.15
5.4.240.1130.05319.29
5.4.230.1030.05019.00
5.4.220.0170.07019.19
5.4.210.0430.08019.18
5.4.200.1100.06019.16
5.4.190.1030.06319.16
5.4.180.0900.06319.15
5.4.170.1030.05719.28
5.4.160.1230.04718.95
5.4.150.1030.06319.14
5.4.140.0930.07016.45
5.4.130.1270.07016.54
5.4.120.1130.06016.47
5.4.110.1030.07716.53
5.4.100.1100.05716.50
5.4.90.1130.04316.42
5.4.80.1070.05016.51
5.4.70.1030.05716.41
5.4.60.1070.05716.53
5.4.50.0730.06316.47
5.4.40.1030.05016.52
5.4.30.1230.04716.39
5.4.20.0930.06316.39
5.4.10.0770.05716.46
5.4.00.1200.03016.04

preferences:
43.17 ms | 401 KiB | 5 Q