3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Simple math class class Staircase { function __construct($numberOfSteps) { $this->numberOfSteps = $numberOfSteps; } //Returns a closure function buildingNumberOfSteps() { //We can't directly use $this inside closure $thisCopy = $this; return function($storeysNumber) use ($thisCopy) { return $storeysNumber*$thisCopy->numberOfSteps; }; } function buildingNumberOfStepsIncludingBasement() { return function($storeysNumber) { return ($storeysNumber + 1)*$this->numberOfSteps; }; } } $staircase = new Staircase(25); $numberOfStepsToReachRoofTopFromGround = $staircase->buildingNumberOfSteps(); $numberOfStepsToReachRoofTopFromBasement = $staircase->buildingNumberOfStepsIncludingBasement(); echo "5.3 <= PHP < 5.4 only allows me to climb from the ground... the ".$numberOfStepsToReachRoofTopFromGround(5)." steps :("; echo "PHP >= 5.4 allows me to climb the ".$numberOfStepsToReachRoofTopFromBasement(5)." steps to reach my rooftop from the basement while "; ?>

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.0120.00318.43
8.3.50.0070.01321.99
8.3.40.0110.00318.96
8.3.30.0100.00618.84
8.3.20.0050.00318.90
8.3.10.0050.00321.09
8.3.00.0070.00021.74
8.2.180.0120.00316.75
8.2.170.0130.01022.96
8.2.160.0000.01420.39
8.2.150.0080.00024.18
8.2.140.0030.00624.66
8.2.130.0080.00026.16
8.2.120.0000.00821.05
8.2.110.0060.00622.16
8.2.100.0090.00317.91
8.2.90.0030.00519.05
8.2.80.0090.00017.97
8.2.70.0040.00417.50
8.2.60.0040.00417.68
8.2.50.0050.00518.07
8.2.40.0000.00918.00
8.2.30.0040.00421.22
8.2.20.0070.00217.67
8.2.10.0040.00417.57
8.2.00.0060.00317.63
8.1.280.0080.00825.92
8.1.270.0040.00423.99
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00322.50
8.1.230.0110.00020.90
8.1.220.0040.00418.77
8.1.210.0040.00418.85
8.1.200.0060.00317.35
8.1.190.0000.00717.52
8.1.180.0000.00818.10
8.1.170.0080.00018.50
8.1.160.0000.00718.88
8.1.150.0080.00018.66
8.1.140.0080.00017.39
8.1.130.0030.00317.75
8.1.120.0040.00417.49
8.1.110.0040.00417.37
8.1.100.0000.00817.47
8.1.90.0040.00417.36
8.1.80.0040.00417.52
8.1.70.0000.00817.48
8.1.60.0060.00317.48
8.1.50.0030.00617.39
8.1.40.0040.00417.50
8.1.30.0000.00817.54
8.1.20.0030.00517.67
8.1.10.0020.00517.50
8.1.00.0000.00817.50
8.0.300.0000.00919.92
8.0.290.0000.00717.04
8.0.280.0000.00718.45
8.0.270.0040.00417.26
8.0.260.0000.00816.83
8.0.250.0000.00816.96
8.0.240.0000.00816.84
8.0.230.0000.00717.00
8.0.220.0040.00416.81
8.0.210.0080.00016.91
8.0.200.0030.00316.83
8.0.190.0000.00716.99
8.0.180.0000.00716.82
8.0.170.0030.00316.81
8.0.160.0000.00717.00
8.0.150.0000.00816.95
8.0.140.0000.01016.92
8.0.130.0000.00713.32
8.0.120.0000.00716.88
8.0.110.0000.00716.78
8.0.100.0070.00016.78
8.0.90.0040.00416.86
8.0.80.0040.01516.90
8.0.70.0040.00416.87
8.0.60.0020.00516.92
8.0.50.0000.00816.80
8.0.30.0070.01116.88
8.0.20.0070.01217.40
8.0.10.0040.00417.08
8.0.00.0070.01016.87
7.4.330.0060.00016.75
7.4.320.0000.00616.41
7.4.300.0000.00816.65
7.4.290.0070.00016.48
7.4.280.0050.00516.45
7.4.270.0000.00716.54
7.4.260.0030.00313.29
7.4.250.0030.00516.55
7.4.240.0000.00716.61
7.4.230.0070.00016.41
7.4.220.0100.01016.55
7.4.210.0110.00716.63
7.4.200.0050.00216.40
7.4.190.0030.00316.67
7.4.160.0140.00316.49
7.4.150.0100.00717.40
7.4.140.0060.01117.86
7.4.130.0100.00716.54
7.4.120.0060.01016.47
7.4.110.0030.01416.43
7.4.100.0140.00516.57
7.4.90.0070.01016.60
7.4.80.0100.00719.39
7.4.70.0080.00816.32
7.4.60.0060.01016.45
7.4.50.0040.00416.43
7.4.40.0100.00722.77
7.4.30.0100.00616.41
7.4.00.0090.00615.18
7.3.330.0050.00013.18
7.3.320.0140.00013.11
7.3.310.0080.00016.27
7.3.300.0040.00416.33
7.3.290.0080.01216.27
7.3.280.0050.01016.34
7.3.270.0070.01017.40
7.3.260.0090.01018.24
7.3.250.0130.00416.43
7.3.240.0030.01316.51
7.3.230.0040.01216.39
7.3.210.0140.00316.34
7.3.200.0100.00719.39
7.3.190.0100.01016.34
7.3.180.0030.01316.55
7.3.170.0120.00416.27
7.3.160.0080.00816.60
7.3.120.0040.01414.68
7.2.330.0000.01616.55
7.2.320.0130.00316.48
7.2.310.0160.01016.39
7.2.300.0090.00916.83
7.2.290.0110.00716.83
7.2.00.0040.01119.60
7.1.100.0070.00418.33
7.1.70.0030.00717.13
7.1.60.0140.01019.40
7.1.50.0060.01917.02
7.1.00.0070.04722.35
7.0.200.0040.00916.79
7.0.140.0000.07322.18
7.0.100.0070.08019.86
7.0.90.0070.07019.93
7.0.80.0070.07719.89
7.0.70.0230.06319.81
7.0.60.0170.03719.89
7.0.50.0070.06720.32
7.0.40.0030.06320.08
7.0.30.0070.08720.07
7.0.20.0070.08319.98
7.0.10.0070.08320.07
7.0.00.0100.09020.07
5.6.280.0000.07721.13
5.6.250.0070.04720.74
5.6.240.0170.07320.68
5.6.230.0130.07720.71
5.6.220.0100.04320.62
5.6.210.0070.04720.52
5.6.200.0130.06320.92
5.6.190.0000.08320.89
5.6.180.0130.07721.13
5.6.170.0000.08020.92
5.6.160.0100.04721.01
5.6.150.0100.07321.08
5.6.140.0000.08020.93
5.6.130.0230.07020.98
5.6.120.0030.05321.03
5.6.110.0100.07320.91
5.6.100.0130.08320.90
5.6.90.0230.04321.11
5.6.80.0000.07020.46
5.6.70.0030.07020.45
5.6.60.0130.03320.35
5.6.50.0130.06020.43
5.6.40.0130.07020.27
5.6.30.0200.04020.46
5.6.20.0070.07720.32
5.6.10.0100.07320.33
5.6.00.0200.06720.38
5.5.380.0170.06720.48
5.5.370.0030.07720.46
5.5.360.0070.06720.36
5.5.350.0070.07320.41
5.5.340.0100.08020.84
5.5.330.0070.08720.61
5.5.320.0130.09020.88
5.5.310.0130.06020.82
5.5.300.0070.04720.69
5.5.290.0030.09020.59
5.5.280.0100.08020.83
5.5.270.0200.05320.79
5.5.260.0070.08320.73
5.5.250.0130.06720.53
5.5.240.0170.07020.25
5.5.230.0200.06720.12
5.5.220.0000.05020.23
5.5.210.0030.06720.12
5.5.200.0100.08020.14
5.5.190.0070.04720.07
5.5.180.0170.07020.18
5.5.160.0170.06320.21
5.5.150.0070.07320.19
5.5.140.0130.07320.21
5.5.130.0070.06720.19
5.5.120.0130.07020.20
5.5.110.0070.03320.20
5.5.100.0000.04320.05
5.5.90.0100.06719.88
5.5.80.0070.07719.97
5.5.70.0070.04320.08
5.5.60.0070.03320.10
5.5.50.0100.03020.07
5.5.40.0130.06019.95
5.5.30.0070.06720.07
5.5.20.0070.08319.99
5.5.10.0130.06720.04
5.5.00.0100.08320.03
5.4.450.0130.06019.23
5.4.440.0070.05019.36
5.4.430.0170.03719.27
5.4.420.0270.03319.22
5.4.410.0070.05719.13
5.4.400.0130.07018.82
5.4.390.0030.08018.95
5.4.380.0100.06719.16
5.4.370.0130.03718.85
5.4.360.0100.07019.14
5.4.350.0100.07719.18
5.4.340.0070.04719.09
5.4.320.0070.07019.22
5.4.310.0130.06318.91
5.4.300.0030.07019.23
5.4.290.0030.04719.12
5.4.280.0070.07319.23
5.4.270.0070.04019.16
5.4.260.0030.08318.87
5.4.250.0000.06319.12
5.4.240.0130.04719.03
5.4.230.0100.06719.08
5.4.220.0130.06718.90
5.4.210.0070.07319.11
5.4.200.0100.03019.22
5.4.190.0030.04319.11
5.4.180.0030.04019.20
5.4.170.0030.04319.06
5.4.160.0030.05319.03
5.4.150.0030.04719.18
5.4.140.0030.06316.45
5.4.130.0100.04716.18
5.4.120.0230.06316.40
5.4.110.0070.07316.32
5.4.100.0100.05716.55
5.4.90.0070.06316.54
5.4.80.0100.05716.38
5.4.70.0030.07016.33
5.4.60.0030.04316.30
5.4.50.0070.03316.33
5.4.40.0070.07316.35
5.4.30.0070.06316.46
5.4.20.0030.04716.44
5.4.10.0070.07316.49
5.4.00.0100.05715.73
5.3.290.0100.04014.82
5.3.280.0070.08314.70
5.3.270.0100.04014.62
5.3.260.0070.07014.61
5.3.250.0070.07714.76
5.3.240.0130.04314.55
5.3.230.0070.04314.59
5.3.220.0070.05014.60
5.3.210.0030.04314.70
5.3.200.0030.08014.59
5.3.190.0100.07714.61
5.3.180.0130.05314.64
5.3.170.0000.08014.70
5.3.160.0070.03714.55
5.3.150.0000.04014.63
5.3.140.0000.04714.51
5.3.130.0070.04714.52
5.3.120.0100.07714.65
5.3.110.0030.08014.62
5.3.100.0000.08314.08
5.3.90.0070.04713.99
5.3.80.0000.08014.14
5.3.70.0100.05313.97
5.3.60.0070.06014.07
5.3.50.0100.06714.09
5.3.40.0130.06713.98
5.3.30.0100.05713.92
5.3.20.0070.07713.70
5.3.10.0030.04313.64
5.3.00.0100.07013.63
5.2.170.0030.06311.25
5.2.160.0030.06011.28
5.2.150.0070.03011.26
5.2.140.0000.06011.04
5.2.130.0070.06011.02
5.2.120.0100.05010.99
5.2.110.0030.06011.11
5.2.100.0030.06310.96
5.2.90.0070.05011.02
5.2.80.0030.05311.11
5.2.70.0000.06711.20
5.2.60.0030.03311.04
5.2.50.0000.03710.91
5.2.40.0100.06310.88
5.2.30.0100.05711.11
5.2.20.0030.03310.97
5.2.10.0030.05710.87
5.2.00.0100.06010.81
5.1.60.0000.05310.05
5.1.50.0070.0439.86
5.1.40.0070.0539.98
5.1.30.0100.04710.35
5.1.20.0000.05010.27
5.1.10.0000.0509.91
5.1.00.0030.05310.07
5.0.50.0030.0478.64
5.0.40.0000.0408.25
5.0.30.0030.0678.31
5.0.20.0030.0478.26
5.0.10.0030.0278.18
5.0.00.0070.0578.17
4.4.90.0100.0307.16
4.4.80.0030.0377.16
4.4.70.0030.0337.16
4.4.60.0030.0277.16
4.4.50.0030.0307.16
4.4.40.0030.0477.16
4.4.30.0030.0307.16
4.4.20.0030.0337.16
4.4.10.0100.0207.16
4.4.00.0030.0537.16
4.3.110.0030.0237.16
4.3.100.0030.0237.16
4.3.90.0000.0237.16
4.3.80.0030.0407.16
4.3.70.0030.0337.16
4.3.60.0030.0337.16
4.3.50.0000.0207.16
4.3.40.0000.0577.16
4.3.30.0000.0177.16
4.3.20.0000.0377.16
4.3.10.0000.0377.16
4.3.00.0000.0377.16

preferences:
38.08 ms | 401 KiB | 5 Q