3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ExtendedArrayObject extends ArrayObject { function offsetExists($offset) { echo __METHOD__, PHP_EOL; return parent::offsetExists($offset); } function offsetGet($offset) { echo __METHOD__, PHP_EOL; return parent::offsetGet($offset); } } class ExtendedArrayAccess implements ArrayAccess { private $data = array(); function __construct(array $array = array()) { $this->data = $array; } function offsetExists($offset) { return array_key_exists($offset, $this->data); } function offsetGet($offset) { return $this->data[$offset]; } function offsetSet($offset, $value) { $this->data[$offset] = $value; } function offsetUnset($offset) { unset($this->data[$offset]); } } function createInputs() { return array( array(), new ArrayObject(), new ExtendedArrayObject(), new ExtendedArrayAccess(), ); } class Tests { function isset_existing_key_with_not_empty_value($array) { $array['foo'] = 1; $this->expect(isset($array['foo']) === true, __FUNCTION__, $array); } function empty_existing_key_with_not_empty_value($array) { $array['foo'] = 1; $this->expect(empty($array['foo']) === false, __FUNCTION__, $array); } function isset_existing_key_with_empty_value($array) { $array['foo'] = 0; $this->expect(isset($array['foo']) === true, __FUNCTION__, $array); } function empty_existing_key_with_empty_value($array) { $array['foo'] = 0; $this->expect(empty($array['foo']) === true, __FUNCTION__, $array); } function isset_non_existent_key($array) { $this->expect(isset($array['foo']) === false, __FUNCTION__, $array); } function empty_non_existent_key($array) { $this->expect(empty($array['foo']) === true, __FUNCTION__, $array); } function isset_existing_key_with_null_value($array) { $array['foo'] = null; $this->expect(isset($array['foo']) === false, __FUNCTION__, $array); } function empty_existing_key_with_null_value($array) { $array['foo'] = null; $this->expect(empty($array['foo']) === true, __FUNCTION__, $array); } private function getType($v) { return is_array($v) ? 'array' : get_class($v); } private function expect($condition, $function, $array) { if (!$condition) { echo $this->getType($array), ' failed ', $function, PHP_EOL; } } } $tests = new Tests; foreach (get_class_methods($tests) as $test) { echo "$test:", PHP_EOL; foreach (createInputs() as $structure) { $tests->$test($structure); } echo PHP_EOL; }

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.0140.00616.63
8.3.50.0110.01017.47
8.3.40.0150.00619.04
8.3.30.0150.00018.84
8.3.20.0040.00418.90
8.3.10.0090.00020.70
8.3.00.0030.00619.50
8.2.180.0120.00916.50
8.2.170.0110.00422.96
8.2.160.0070.01118.96
8.2.150.0090.00324.18
8.2.140.0030.00524.66
8.2.130.0110.00426.16
8.2.120.0000.00821.00
8.2.110.0100.00021.06
8.2.100.0050.00817.91
8.2.90.0050.00319.70
8.2.80.0050.00318.03
8.2.70.0000.00818.03
8.2.60.0050.00318.16
8.2.50.0000.00818.10
8.2.40.0030.00718.16
8.2.30.0000.00821.21
8.2.20.0000.00819.51
8.2.10.0040.00417.86
8.2.00.0000.00817.78
8.1.280.0030.01525.92
8.1.270.0030.00623.99
8.1.260.0080.00026.35
8.1.250.0060.00328.09
8.1.240.0060.00320.93
8.1.230.0040.00820.79
8.1.220.0050.00317.74
8.1.210.0030.00618.77
8.1.200.0090.00017.22
8.1.190.0050.00317.11
8.1.180.0040.00418.10
8.1.170.0080.00018.49
8.1.160.0080.00018.81
8.1.150.0000.00718.68
8.1.140.0040.00417.41
8.1.130.0000.00817.88
8.1.120.0000.00817.47
8.1.110.0040.00417.39
8.1.100.0040.00417.38
8.1.90.0040.00417.50
8.1.80.0040.00417.49
8.1.70.0040.00417.47
8.1.60.0090.00017.64
8.1.50.0040.00417.55
8.1.40.0030.00517.58
8.1.30.0060.00317.71
8.1.20.0040.00417.68
8.1.10.0060.00317.61
8.1.00.0000.00817.48
8.0.300.0080.00020.20
8.0.290.0080.00016.75
8.0.280.0000.00718.50
8.0.270.0040.00416.83
8.0.260.0030.00316.93
8.0.250.0030.00516.88
8.0.240.0050.00316.88
8.0.230.0030.00316.99
8.0.220.0000.00816.94
8.0.210.0070.00016.85
8.0.200.0000.00616.85
8.0.190.0050.00216.83
8.0.180.0000.00816.87
8.0.170.0090.00016.80
8.0.160.0040.00416.99
8.0.150.0080.00016.87
8.0.140.0060.00316.92
8.0.130.0060.00013.37
8.0.120.0000.00716.73
8.0.110.0040.00416.87
8.0.100.0070.00016.77
8.0.90.0070.00016.94
8.0.80.0110.00616.82
8.0.70.0000.00816.97
8.0.60.0000.00816.82
8.0.50.0000.00716.98
8.0.30.0160.00017.35
8.0.20.0080.01417.17
8.0.10.0040.00417.02
8.0.00.0080.01316.82
7.4.330.0000.00513.01
7.4.320.0030.00316.57
7.4.300.0000.00616.56
7.4.290.0040.00416.46
7.4.280.0000.00816.55
7.4.270.0030.00316.64
7.4.260.0000.00713.31
7.4.250.0060.00316.49
7.4.240.0000.00816.54
7.4.230.0000.00716.55
7.4.220.0100.01016.70
7.4.210.0060.01416.42
7.4.200.0000.00816.35
7.4.190.0000.00716.69
7.4.160.0110.00616.60
7.4.150.0070.01116.57
7.4.140.0090.00916.39
7.4.130.0000.02116.66
7.4.120.0180.00016.56
7.4.110.0120.01216.73
7.4.100.0070.01116.69
7.4.90.0080.01216.57
7.4.80.0090.01319.39
7.4.70.0160.00516.54
7.4.60.0070.01016.57
7.4.50.0000.00816.65
7.4.40.0060.01216.40
7.4.30.0030.01316.52
7.4.00.0100.00715.18
7.3.330.0000.00613.41
7.3.320.0070.00013.21
7.3.310.0000.00716.25
7.3.300.0030.00316.25
7.3.290.0030.01116.39
7.3.280.0040.01316.41
7.3.270.0180.00716.37
7.3.260.0040.01416.66
7.3.250.0100.00816.56
7.3.240.0060.01216.81
7.3.230.0070.01016.66
7.3.210.0080.00816.47
7.3.200.0000.01716.70
7.3.190.0040.01516.60
7.3.180.0060.01116.69
7.3.170.0130.00316.61
7.3.160.0080.01416.46
7.3.120.0090.00614.82
7.3.10.0000.01016.69
7.3.00.0070.00716.81
7.2.330.0130.00716.82
7.2.320.0120.00616.78
7.2.310.0190.01016.74
7.2.300.0180.00616.65
7.2.290.0040.01616.87
7.2.130.0030.00717.02
7.2.120.0000.00917.04
7.2.110.0070.00717.04
7.2.100.0000.01616.81
7.2.90.0080.00516.78
7.2.80.0110.00316.80
7.2.70.0080.00417.01
7.2.60.0050.00816.97
7.2.50.0140.00616.91
7.2.40.0050.00517.20
7.2.30.0110.00016.99
7.2.20.0080.00816.91
7.2.10.0060.00617.00
7.2.00.0130.00316.95
7.1.250.0030.01015.71
7.1.200.0090.00615.55
7.1.70.0050.00517.05
7.1.60.0100.01419.31
7.1.50.0060.00616.72
7.1.00.0000.07322.31
7.0.200.0040.00416.66
7.0.140.0070.07021.94
7.0.120.0000.07722.05
7.0.60.0100.04719.97
7.0.50.0070.08018.02
7.0.40.0130.08020.11
7.0.30.0270.09020.08
7.0.20.0300.08320.07
7.0.10.0030.08020.23
7.0.00.0030.08720.16
5.6.280.0030.07721.19
5.6.210.0100.07720.79
5.6.200.0130.07718.18
5.6.190.0200.06720.33
5.6.180.0230.05020.41
5.6.170.0330.08020.57
5.6.160.0100.08720.57
5.6.150.0030.08718.18
5.6.140.0070.07018.20
5.6.130.0030.08018.27
5.6.120.0030.04721.18
5.6.110.0100.03721.08
5.6.100.0170.06321.15
5.6.90.0070.07021.06
5.6.80.0100.05320.57
5.5.350.4130.04320.51
5.5.340.0100.08017.98
5.5.330.0130.04720.37
5.5.320.0300.04320.36
5.5.310.0230.06320.25
5.5.300.0070.04718.10
5.5.290.0070.07717.97
5.5.280.0100.04020.84
5.5.270.0000.06320.90
5.5.260.0070.08320.80
5.5.250.0130.07720.65
5.5.240.0170.08020.19
5.4.450.0200.08019.54
5.4.440.0170.05719.20
5.4.430.0230.03719.19
5.4.420.0230.04319.56
5.4.410.0200.03719.32
5.4.400.0200.07718.98
5.4.390.0270.07019.22
5.4.380.0270.06019.13
5.4.370.0300.06319.22
5.4.360.0370.06319.16
5.4.350.0170.05718.87
5.4.340.0330.06319.06
5.4.320.0370.04019.21
5.4.310.0130.05319.08
5.4.300.0230.05019.15
5.4.290.0270.04019.15
5.4.280.0300.06019.22
5.4.270.0200.04018.99
5.4.260.0200.05719.23
5.4.250.0200.04719.10
5.4.240.0300.04319.19
5.4.230.0200.06719.00
5.4.220.0170.05019.23
5.4.210.0230.07319.19
5.4.200.0200.07018.87
5.4.190.0270.04719.30
5.4.180.0300.07319.22
5.4.170.0270.04319.13
5.4.160.0300.06318.93
5.4.150.0230.03719.13
5.4.140.0300.04316.58
5.4.130.0270.06016.34
5.4.120.0300.04016.43
5.4.110.0270.04716.50
5.4.100.0200.03716.50
5.4.90.0200.04316.61
5.4.80.0170.07316.41
5.4.70.0300.06716.49
5.4.60.0300.04316.40
5.4.50.0300.06716.61
5.4.40.0200.06016.45
5.4.30.0270.06316.51
5.4.20.0200.04716.55
5.4.10.0230.05016.56
5.4.00.0230.04716.01
5.3.290.0170.05314.93
5.3.280.0200.03714.56
5.3.270.0200.07714.70
5.3.260.0200.04314.71
5.3.250.0200.04314.70
5.3.240.0270.06714.57
5.3.230.0230.04014.80
5.3.220.0300.07314.52
5.3.210.0200.06714.54
5.3.200.0200.04314.59
5.3.190.0170.04014.61
5.3.180.0200.04714.59
5.3.170.0370.04014.63
5.3.160.0230.06314.54
5.3.150.0300.05014.78
5.3.140.0270.05314.73
5.3.130.0370.03714.57
5.3.120.0230.05014.51
5.3.110.0330.06314.58
5.3.100.0270.04714.06
5.3.90.0170.04313.98
5.3.80.0230.03013.99
5.3.70.0100.04314.12
5.3.60.0130.04013.95
5.3.50.0200.07713.91
5.3.40.0200.03714.09
5.3.30.0230.04713.87
5.3.20.0330.06313.91
5.3.10.0170.03713.82
5.3.00.0270.06713.80
5.2.170.0200.03011.38
5.2.160.0200.05711.16
5.2.150.0200.06011.13
5.2.140.0230.04011.25
5.2.130.0230.05711.11
5.2.120.0130.03711.32
5.2.110.0170.06011.07
5.2.100.0200.03011.13
5.2.90.0270.05011.17
5.2.80.0200.06011.20
5.2.70.0170.04011.05
5.2.60.0130.06311.22
5.2.50.0230.04010.98
5.2.40.0100.03711.21
5.2.30.0100.04311.11
5.2.20.0200.02310.95
5.2.10.0200.03010.89
5.2.00.0200.04710.75
5.1.60.0170.0309.96
5.1.50.0170.0439.96
5.1.40.0130.0479.99
5.1.30.0130.03310.48
5.1.20.0130.06010.53
5.1.10.0170.04710.20
5.1.00.0170.05710.11
5.0.50.0070.05010.04
5.0.40.0170.03010.04
5.0.30.0100.04710.04
5.0.20.0100.03710.06
5.0.10.0200.01310.08
5.0.00.0070.05710.10
4.4.90.0100.0179.96
4.4.80.0100.0239.96
4.4.70.0130.0139.96
4.4.60.0100.0279.96
4.4.50.0130.0309.96
4.4.40.0170.0409.96
4.4.30.0130.0309.98
4.4.20.0100.03310.00
4.4.10.0070.02710.04
4.4.00.0130.04710.04
4.3.110.0100.02710.04
4.3.100.0130.03010.05
4.3.90.0070.03310.07
4.3.80.0070.03710.11
4.3.70.0030.03710.11
4.3.60.0100.03310.11
4.3.50.0170.02310.11
4.3.40.0100.04310.11
4.3.30.0100.02710.11
4.3.20.0030.04010.11
4.3.10.0100.02710.12
4.3.00.0070.02710.12

preferences:
36.32 ms | 401 KiB | 5 Q