3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Condition { private $value; private $variable = false; public function setCondition($new_value) { switch ($new_value) { case 'cond2': $this->variable = true; break; case 'cond4': $this->variable = false; break; } $this->value = $new_value; } public function getCondition() { return $this->value; } public function isVariableSet() { return ($this->variable === true); } } $conditions = array( 'cond1', 'cond2', 'cond3', 'cond4','cond5' ); $cond = new Condition(); $results = array(); $setCondGetVariable = function($condition) use($cond) { $cond->setCondition($condition); if ($cond->isVariableSet() == true) { $toggle = 'on'; } else { $toggle = 'off'; } return $toggle.' ; '; }; $results = array_map($setCondGetVariable, $conditions); var_dump($results);

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.0110.00716.50
8.3.50.0080.01022.15
8.3.40.0040.01118.61
8.3.30.0040.01119.21
8.3.20.0140.00320.16
8.3.10.0080.00023.66
8.3.00.0000.01017.63
8.2.180.0040.01818.34
8.2.170.0120.00922.96
8.2.160.0100.00320.35
8.2.150.0070.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0110.00422.30
8.2.110.0000.01022.27
8.2.100.0090.00317.72
8.2.90.0000.00819.27
8.2.80.0000.00818.04
8.2.70.0090.00017.61
8.2.60.0040.00417.80
8.2.50.0000.00818.07
8.2.40.0030.00619.88
8.2.30.0000.00819.72
8.2.20.0000.00817.62
8.2.10.0040.00418.15
8.2.00.0040.00417.58
8.1.280.0040.01125.92
8.1.270.0030.00623.88
8.1.260.0000.01526.35
8.1.250.0000.00728.09
8.1.240.0060.00323.84
8.1.230.0040.00819.17
8.1.220.0040.00417.79
8.1.210.0040.00418.77
8.1.200.0000.01017.13
8.1.190.0030.00617.35
8.1.180.0040.00718.10
8.1.170.0040.00718.57
8.1.160.0000.00822.04
8.1.150.0000.00718.71
8.1.140.0000.00717.39
8.1.130.0000.00717.86
8.1.120.0040.00417.38
8.1.110.0050.00317.40
8.1.100.0040.00417.48
8.1.90.0030.00517.38
8.1.80.0030.00717.54
8.1.70.0000.01017.43
8.1.60.0050.00317.61
8.1.50.0030.00517.58
8.1.40.0030.00617.59
8.1.30.0030.00617.57
8.1.20.0000.00817.69
8.1.10.0000.00817.59
8.1.00.0040.00417.44
8.0.300.0080.00020.73
8.0.290.0020.00517.18
8.0.280.0030.00518.40
8.0.270.0000.00717.32
8.0.260.0000.00617.32
8.0.250.0070.00016.91
8.0.240.0000.00716.89
8.0.230.0050.00316.88
8.0.220.0000.00716.91
8.0.210.0030.00316.94
8.0.200.0000.00816.95
8.0.190.0040.00417.00
8.0.180.0050.00516.90
8.0.170.0090.00016.80
8.0.160.0040.00416.87
8.0.150.0090.00316.80
8.0.140.0040.00416.86
8.0.130.0000.00913.35
8.0.120.0050.00316.77
8.0.110.0050.00216.89
8.0.100.0070.00016.77
8.0.90.0000.00716.90
8.0.80.0100.00716.84
8.0.70.0040.00416.78
8.0.60.0040.00416.96
8.0.50.0000.00716.95
8.0.30.0110.00817.08
8.0.20.0150.00417.40
8.0.10.0040.00416.98
8.0.00.0100.00916.79
7.4.330.0000.00715.00
7.4.320.0080.00016.66
7.4.300.0030.00316.64
7.4.290.0040.00416.65
7.4.280.0080.00016.62
7.4.270.0000.00716.66
7.4.260.0030.00316.40
7.4.250.0040.00416.44
7.4.240.0060.00116.51
7.4.230.0070.00016.67
7.4.220.0090.01516.57
7.4.210.0090.00916.56
7.4.200.0000.00716.50
7.4.190.0030.00316.38
7.4.160.0110.00616.44
7.4.150.0150.00317.40
7.4.140.0080.00717.86
7.4.130.0110.00916.56
7.4.120.0120.00516.57
7.4.110.0080.00816.52
7.4.100.0090.00916.64
7.4.90.0100.00616.34
7.4.80.0130.00619.39
7.4.70.0140.00316.43
7.4.60.0120.00416.41
7.4.50.0040.00416.52
7.4.40.0100.00716.25
7.4.30.0040.01216.23
7.4.00.0070.00715.20
7.3.330.0000.00613.09
7.3.320.0000.00713.05
7.3.310.0040.00416.18
7.3.300.0030.00316.26
7.3.290.0140.00416.25
7.3.280.0080.01016.28
7.3.270.0110.00517.40
7.3.260.0170.00016.50
7.3.250.0100.00716.49
7.3.240.0160.00016.41
7.3.230.0100.00716.43
7.3.210.0060.01116.56
7.3.200.0090.01519.39
7.3.190.0060.01616.55
7.3.180.0110.00516.54
7.3.170.0040.01316.48
7.3.160.0080.00816.61
7.3.120.0000.01714.91
7.2.330.0160.00316.80
7.2.320.0090.00916.57
7.2.310.0150.00616.43
7.2.300.0040.01816.57
7.2.290.0100.00716.50
7.2.60.0060.00616.81
7.2.00.0060.00619.66
7.1.200.0100.00315.67
7.1.100.0030.00918.18
7.1.70.0080.00017.18
7.1.60.0070.01819.46
7.1.50.0130.00716.99
7.1.00.0100.07022.31
7.0.200.0000.00716.89
7.0.140.0000.07722.01
7.0.60.0100.04319.89
7.0.50.0070.08317.87
7.0.40.0130.08020.26
7.0.30.0230.05020.30
7.0.20.0330.07020.24
7.0.10.0130.08320.22
7.0.00.0070.06720.05
5.6.280.0030.07321.08
5.6.210.0030.04720.60
5.6.200.0030.07718.19
5.6.190.0130.07720.50
5.6.180.0170.04020.48
5.6.170.0300.07720.51
5.6.160.0030.06320.47
5.6.150.0070.08318.27
5.6.140.0000.04318.18
5.6.130.0130.06018.15
5.6.120.0100.08320.99
5.6.110.0000.04321.02
5.6.100.0030.05321.11
5.6.90.0100.07021.01
5.6.80.0070.05020.49
5.5.350.3870.03320.43
5.5.340.0100.05717.92
5.5.330.0170.06020.29
5.5.320.0300.03320.22
5.5.310.0300.07720.32
5.5.300.0030.04317.95
5.5.290.0130.06318.07
5.5.280.0100.06320.77
5.5.270.0030.08720.89
5.5.260.0130.07320.77
5.5.250.0000.04720.51
5.5.240.0030.08720.27
5.4.450.0170.06319.54
5.4.440.0100.06019.44
5.4.430.0130.05319.57
5.4.420.0100.05719.38
5.4.410.0170.04719.52
5.4.400.0130.05319.37
5.4.390.0070.08319.24
5.4.380.0170.05318.79
5.4.370.0200.06018.61
5.4.360.0100.05718.75
5.4.350.0130.05718.73
5.4.340.0270.06018.79
5.4.320.0050.03712.51
5.4.310.0090.03512.51
5.4.300.0030.03912.51
5.4.290.0060.05512.50
5.4.280.0070.04912.40
5.4.270.0050.05012.40
5.4.260.0090.05112.41
5.4.250.0090.05112.41
5.4.240.0090.04912.41
5.4.230.0160.04412.39
5.4.220.0160.04512.39
5.4.210.0260.07312.39
5.4.200.0110.05812.39
5.4.190.0090.05012.39
5.4.180.0140.07712.39
5.4.170.0080.05012.40
5.4.160.0090.04812.39
5.4.150.0140.04512.40
5.4.140.0110.05612.08
5.4.130.0170.04912.07
5.4.120.0160.04912.03
5.4.110.0140.04912.02
5.4.100.0100.05112.02
5.4.90.0120.04612.02
5.4.80.0080.04912.02
5.4.70.0050.05112.02
5.4.60.0150.04112.02
5.4.50.0060.05112.02
5.4.40.0060.04612.00
5.4.30.0040.04112.00
5.4.20.0050.04112.00
5.4.10.0050.03912.00
5.4.00.0110.03511.49
5.3.290.0040.04712.80
5.3.280.0020.04812.71
5.3.270.0070.04412.72
5.3.260.0090.05212.71
5.3.250.0100.07012.72
5.3.240.0130.07212.71
5.3.230.0120.07212.71
5.3.220.0200.08312.68
5.3.210.0050.06712.68
5.3.200.0200.08812.68
5.3.190.0110.08212.68
5.3.180.0110.04712.67
5.3.170.0150.11412.66
5.3.160.0140.08712.67
5.3.150.0110.05712.67
5.3.140.0100.04312.66
5.3.130.0140.05012.66
5.3.120.0220.08212.65
5.3.110.0080.05912.66
5.3.100.0120.06312.12
5.3.90.0040.05812.11
5.3.80.0100.07412.10
5.3.70.0150.06312.10
5.3.60.0350.12912.08
5.3.50.0160.07812.04
5.3.40.0170.06812.03
5.3.30.0120.06311.99
5.3.20.0170.06011.78
5.3.10.0200.07511.73
5.3.00.0340.11411.72
5.2.170.0100.0489.23
5.2.160.0110.0469.23
5.2.150.0080.0399.23
5.2.140.0070.0439.23
5.2.130.0100.0659.19
5.2.120.0150.0649.19
5.2.110.0060.0389.20
5.2.100.0120.0359.18
5.2.90.0030.0349.19
5.2.80.0070.0339.19
5.2.70.0120.0299.18
5.2.60.0070.0359.14
5.2.50.0060.0339.11
5.2.40.0090.0319.08
5.2.30.0150.0819.05
5.2.20.0130.0499.04
5.2.10.0140.0708.95
5.2.00.0120.0628.82
5.1.60.0050.0338.10
5.1.50.0060.0328.10
5.1.40.0070.0498.07
5.1.30.0130.0608.43
5.1.20.0160.0648.44
5.1.10.0040.0378.18
5.1.00.0080.0268.18
5.0.50.0040.0226.65
5.0.40.0030.0246.52
5.0.30.0150.0806.32
5.0.20.0160.1046.29
5.0.10.0040.0476.27
5.0.00.0030.0616.26
4.4.90.0130.0384.78
4.4.80.0050.0314.75
4.4.70.0040.0254.75
4.4.60.0080.0244.75
4.4.50.0060.0224.77
4.4.40.0050.0394.71
4.4.30.0150.0374.76
4.4.20.0100.0214.84
4.4.10.0040.0174.85
4.4.00.0030.0274.75
4.3.110.0060.0164.66
4.3.100.0080.0144.66
4.3.90.0050.0324.63
4.3.80.0100.0464.59
4.3.70.0140.0424.63
4.3.60.0080.0474.63
4.3.50.0040.0214.63
4.3.40.0030.0254.53
4.3.30.0030.0163.30
4.3.20.0020.0173.28
4.3.10.0030.0183.23
4.3.00.0100.0138.64

preferences:
50.24 ms | 401 KiB | 5 Q