3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Condition { var $causedNext = false; var $cause = null; public function __construct($at, $next = null) { $this->at = $at; $this->next = $next; } public function evalCondition() { $this->causedNext = false; $result = $this->actualEval(); if ($result !== false && $this->next) { $result = $this->next->evalCondition(); if ($result === false) $this->causedNext = true; } return $result; } public function actualEval() { return false; } public function getCause() { return $this->causedNext ? $this->next->getCause() : $this->cause; } } class Condition1 extends Condition { public function __construct($at, $next = null) { parent::__construct($at, $next); $this->cause = "cause 1"; } public function actualEval() { return $this->at->condition1; } } class Condition2 extends Condition { public function __constructor($at, $next = null) { parent::__constructor($at, $next); $this->cause = "cause 2"; } public function actualEval() { return $this->at->condition2; } } class X { var $condition1 = false; var $condition2 = false; public function __construct($c1, $c2) { $this->condition1 = $c1; $this->condition2 = $c2; } protected function check(\Closure $callback) { $condition = new Condition1( $this, new Condition2($this) ); if (!$condition->evalCondition()) { $this->log($condition->getCause()); } else return $callback(); $this->cleanup(); return null; } public function doSomething() { $this->check($this->reallyDoSomething); } public function reallyDoSomething() { echo "! Done!"; } public function cleanup() { echo "* cleanup...\n"; } public function log($str) { echo "> $str\n"; } } echo "f, f\n"; $x = new X(false, false); $x->doSomething(); echo "f, t\n"; $x = new X(false, true); $x->doSomething(); echo "t, f\n"; $x = new X(true, false); $x->doSomething(); echo "t, t\n"; $x = new X(true, true); $x->doSomething();

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.0150.00316.88
8.3.50.0110.00921.21
8.3.40.0110.00718.91
8.3.30.0040.01118.84
8.3.20.0150.00020.34
8.3.10.0040.00421.73
8.3.00.0080.00021.85
8.2.180.0110.00416.63
8.2.170.0040.01122.96
8.2.160.0070.00720.39
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0040.00420.93
8.2.120.0060.00326.35
8.2.110.0030.00719.30
8.2.100.0040.00817.93
8.2.90.0040.00419.17
8.2.80.0000.00817.97
8.2.70.0000.00917.74
8.2.60.0000.00817.80
8.2.50.0040.00418.09
8.2.40.0080.00022.09
8.2.30.0000.00819.47
8.2.20.0040.00417.72
8.2.10.0050.00317.91
8.2.00.0040.00418.03
8.1.280.0150.00025.92
8.1.270.0090.00022.19
8.1.260.0080.00428.09
8.1.250.0040.00428.09
8.1.240.0130.01020.56
8.1.230.0130.00017.70
8.1.220.0040.00417.74
8.1.210.0080.00018.77
8.1.200.0040.00417.23
8.1.190.0040.00417.22
8.1.180.0040.00418.10
8.1.170.0000.00818.55
8.1.160.0000.00820.61
8.1.150.0040.00420.64
8.1.140.0040.00419.55
8.1.130.0040.00417.63
8.1.120.0040.00417.30
8.1.110.0050.00317.43
8.1.100.0040.00417.35
8.1.90.0040.00417.49
8.1.80.0000.00717.41
8.1.70.0000.00717.32
8.1.60.0080.00017.65
8.1.50.0060.00317.53
8.1.40.0000.01017.56
8.1.30.0050.00317.61
8.1.20.0040.00417.61
8.1.10.0050.00317.58
8.1.00.0030.00617.52
8.0.300.0040.00418.77
8.0.290.0000.00716.88
8.0.280.0000.00718.48
8.0.270.0000.00717.30
8.0.260.0040.00417.21
8.0.250.0030.00516.94
8.0.240.0080.00016.84
8.0.230.0040.00416.89
8.0.220.0030.00316.82
8.0.210.0040.00416.93
8.0.200.0060.00016.89
8.0.190.0000.01116.95
8.0.180.0040.00416.87
8.0.170.0000.00716.84
8.0.160.0070.00016.93
8.0.150.0000.00716.94
8.0.140.0050.00216.92
8.0.130.0060.00013.41
8.0.120.0000.00816.80
8.0.110.0040.00416.87
8.0.100.0070.00016.99
8.0.90.0050.00316.73
8.0.80.0120.00917.00
8.0.70.0050.00316.83
8.0.60.0000.00816.81
8.0.50.0000.00916.88
8.0.30.0140.00516.96
8.0.20.0100.00917.40
8.0.10.0070.00017.09
8.0.00.0090.01216.77
7.4.330.0000.00516.67
7.4.320.0030.00316.69
7.4.300.0000.00716.53
7.4.290.0070.00016.62
7.4.280.0000.00816.59
7.4.270.0000.00716.64
7.4.260.0040.00416.53
7.4.250.0040.00416.50
7.4.240.0000.00816.48
7.4.230.0070.00016.63
7.4.220.0130.01016.61
7.4.210.0100.00516.54
7.4.200.0000.00816.69
7.4.160.0060.00916.57
7.4.150.0160.01017.40
7.4.140.0120.00617.86
7.4.130.0100.00716.46
7.4.120.0130.00516.65
7.4.110.0150.00416.65
7.4.100.0030.01416.56
7.4.90.0150.00616.57
7.4.80.0100.00719.39
7.4.70.0040.01316.61
7.4.60.0030.01316.54
7.4.50.0110.00416.45
7.4.40.0090.00916.65
7.4.30.0230.00016.50
7.4.00.0050.01114.86
7.3.330.0000.00513.30
7.3.320.0000.00513.45
7.3.310.0030.00316.46
7.3.300.0000.00716.34
7.3.290.0000.00716.48
7.3.280.0080.01216.38
7.3.270.0090.00917.40
7.3.260.0120.00616.43
7.3.250.0100.00716.42
7.3.240.0090.00916.50
7.3.230.0100.00716.59
7.3.210.0100.00716.49
7.3.200.0150.00619.39
7.3.190.0080.00816.57
7.3.180.0140.00316.49
7.3.170.0150.00016.65
7.3.160.0100.00616.47
7.3.120.0040.01514.71
7.3.110.0130.00614.97
7.3.100.0040.00814.89
7.3.90.0110.00414.95
7.3.80.0060.00314.99
7.3.70.0100.00315.10
7.3.60.0040.00814.92
7.3.50.0090.00314.89
7.3.40.0030.00615.05
7.3.30.0100.00314.94
7.3.20.0100.00616.52
7.3.10.0060.00616.77
7.3.00.0070.00716.70
7.2.330.0090.00916.55
7.2.320.0090.01216.81
7.2.310.0030.01316.63
7.2.300.0060.01216.78
7.2.290.0070.01016.70
7.2.250.0040.01514.89
7.2.240.0060.01515.21
7.2.230.0090.00614.88
7.2.220.0060.00915.06
7.2.210.0000.01115.33
7.2.200.0050.00514.70
7.2.190.0060.00915.08
7.2.180.0090.00015.09
7.2.170.0060.00814.79
7.2.160.0130.00015.16
7.2.150.0060.00916.86
7.2.140.0040.01116.84
7.2.130.0100.00716.70
7.2.120.0000.01116.73
7.2.110.0030.00616.96
7.2.100.0070.00716.64
7.2.90.0030.00916.99
7.2.80.0060.01017.08
7.2.70.0030.00916.70
7.2.60.0030.01116.89
7.2.50.0000.00916.81
7.2.40.0030.01016.98
7.2.30.0030.00617.10
7.2.20.0100.00317.07
7.2.10.0100.00316.93
7.2.00.0040.00618.01
7.1.330.0000.01215.50
7.1.320.0090.00015.69
7.1.310.0030.00715.71
7.1.300.0030.00915.64
7.1.290.0070.00715.64
7.1.280.0030.00915.74
7.1.270.0070.00715.64
7.1.260.0040.00715.44
7.1.250.0040.00715.78
7.1.240.0130.00015.58
7.1.230.0080.00415.57
7.1.220.0060.00615.51
7.1.210.0030.00515.72
7.1.200.0020.01115.59
7.1.190.0040.00815.72
7.1.180.0030.00915.85
7.1.170.0080.00315.73
7.1.160.0060.00615.88
7.1.150.0000.01015.48
7.1.140.0070.00715.60
7.1.130.0120.00315.85
7.1.120.0060.00315.60
7.1.110.0030.01015.63
7.1.100.0030.00916.75
7.1.90.0110.00415.64
7.1.80.0070.00715.73
7.1.70.0000.01016.41
7.1.60.0090.00917.50
7.1.50.0090.00816.19
7.1.40.0030.01415.68
7.1.30.0040.00815.51
7.1.20.0040.01115.64
7.1.10.0030.00915.63
7.1.00.0030.04819.07
7.0.330.0090.00615.29
7.0.320.0030.01015.27
7.0.310.0000.00815.20
7.0.300.0090.00415.53
7.0.290.0030.00915.10
7.0.280.0000.00815.38
7.0.270.0100.00015.40
7.0.260.0030.00615.31
7.0.250.0100.00715.49
7.0.240.0000.01315.28
7.0.230.0070.00715.17
7.0.220.0070.00715.52
7.0.210.0050.00515.29
7.0.200.0030.00916.12
7.0.190.0070.00715.37
7.0.180.0030.01015.44
7.0.170.0050.00515.50
7.0.160.0040.01115.53
7.0.150.0110.00015.40
7.0.140.0030.00715.47
7.0.130.0000.00915.23
7.0.120.0070.00315.55
7.0.110.0070.00715.57
7.0.100.0050.00315.45
7.0.90.0060.00915.25
7.0.80.0030.01315.48
7.0.70.0030.01015.60
7.0.60.0150.03218.54
7.0.50.0030.02516.60
7.0.40.0070.04516.68
7.0.30.0130.02516.85
7.0.20.0250.03616.78
7.0.10.0070.02516.84
7.0.00.0050.03316.78
5.6.400.0040.00714.07
5.6.390.0040.00414.52
5.6.380.0100.00614.28
5.6.370.0030.00914.66
5.6.360.0000.00814.23
5.6.350.0070.00414.60
5.6.340.0050.00514.40
5.6.330.0000.01714.62
5.6.320.0070.00314.47
5.6.310.0000.01414.27
5.6.300.0030.01014.20
5.6.290.0040.00414.79
5.6.280.0050.03717.71
5.6.270.0000.01514.57
5.6.260.0080.00414.28
5.6.250.0130.00014.14
5.6.240.0030.00914.33
5.6.230.0110.00714.56
5.6.220.0070.00714.43
5.6.210.0030.02617.58
5.6.200.0050.04916.27
5.6.190.0050.03317.38
5.6.180.0180.04517.48
5.6.170.0120.04017.40
5.6.160.0070.04517.34
5.6.150.0060.02416.37
5.6.140.0000.04716.35
5.6.130.0070.04316.45
5.6.120.0050.04017.60
5.6.110.0090.04317.62
5.6.100.0090.04917.66
5.6.90.0100.04417.54
5.6.80.0050.03817.24
5.6.70.0080.00414.35
5.6.60.0040.00714.15
5.6.50.0060.00614.12
5.6.40.0130.00314.53
5.6.30.0030.01014.39
5.6.20.0030.00914.41
5.6.10.0060.00614.32
5.6.00.0030.00914.00
5.5.380.0030.01014.68
5.5.370.0070.01114.51
5.5.360.0060.00914.02
5.5.350.0140.03717.43
5.5.340.0030.05016.22
5.5.330.0040.02717.27
5.5.320.0120.03617.34
5.5.310.0210.04117.43
5.5.300.0050.02716.27
5.5.290.0120.04216.18
5.5.280.0070.04617.66
5.5.270.0090.02017.65
5.5.260.0130.02017.59
5.5.250.0080.04317.34
5.5.240.0150.01517.25
5.5.230.0000.01013.99
5.5.220.0120.00014.31
5.5.210.0000.00814.32
5.5.200.0040.00814.11
5.5.190.0000.00914.17
5.5.180.0030.00714.53
5.5.170.0000.01514.08
5.5.160.0060.00614.06
5.5.150.0090.00314.36
5.5.140.0060.00614.47
5.5.130.0030.00614.12
5.5.120.0060.00614.06
5.5.110.0100.00313.93
5.5.100.0000.01314.47
5.5.90.0030.01414.12
5.5.80.0060.00914.08
5.5.70.0000.01414.33
5.5.60.0000.00914.27
5.5.50.0050.00514.32
5.5.40.0100.00314.12
5.5.30.0060.00614.38
5.5.20.0000.01414.00
5.5.10.0090.00614.27
5.5.00.0070.01014.07

preferences:
47.55 ms | 401 KiB | 5 Q