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) { foreach (createInputs() as $structure) { $tests->$test($structure); } }

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.0090.01217.00
8.3.50.0170.00317.66
8.3.40.0070.00718.88
8.3.30.0120.00318.84
8.3.20.0060.00318.63
8.3.10.0060.00320.70
8.3.00.0030.01219.38
8.2.180.0130.01316.63
8.2.170.0070.00722.96
8.2.160.0040.01120.82
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0090.00019.49
8.2.110.0030.00722.11
8.2.100.0120.00017.84
8.2.90.0000.00819.22
8.2.80.0040.00417.97
8.2.70.0090.00017.50
8.2.60.0060.00318.05
8.2.50.0030.00618.07
8.2.40.0040.00418.09
8.2.30.0080.00018.26
8.2.20.0030.00619.56
8.2.10.0000.00817.85
8.2.00.0030.00617.84
8.1.280.0120.00325.92
8.1.270.0030.00623.99
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0090.00022.06
8.1.230.0040.00717.52
8.1.220.0050.00317.74
8.1.210.0030.00518.77
8.1.200.0060.00317.35
8.1.190.0030.00617.41
8.1.180.0080.00018.10
8.1.170.0000.00918.80
8.1.160.0000.00918.94
8.1.150.0080.00018.68
8.1.140.0050.00322.14
8.1.130.0030.00517.92
8.1.120.0040.00417.54
8.1.110.0040.00417.38
8.1.100.0040.00417.50
8.1.90.0080.00017.42
8.1.80.0000.00817.41
8.1.70.0000.00717.45
8.1.60.0050.00317.66
8.1.50.0020.00517.41
8.1.40.0040.00417.52
8.1.30.0000.00817.59
8.1.20.0040.00417.59
8.1.10.0000.00717.61
8.1.00.0000.00717.57
8.0.300.0000.00718.77
8.0.290.0000.00716.88
8.0.280.0030.00518.41
8.0.270.0000.01017.29
8.0.260.0030.00316.78
8.0.250.0040.00417.03
8.0.240.0000.00817.06
8.0.230.0000.00716.98
8.0.220.0000.00817.01
8.0.210.0070.00016.89
8.0.200.0000.00817.04
8.0.190.0070.00017.06
8.0.180.0000.00716.86
8.0.170.0060.00316.95
8.0.160.0060.00317.02
8.0.150.0000.00816.84
8.0.140.0020.00516.85
8.0.130.0050.00013.33
8.0.120.0000.00716.85
8.0.110.0000.00816.89
8.0.100.0040.00416.95
8.0.90.0040.00416.77
8.0.80.0060.00916.83
8.0.70.0040.00416.82
8.0.60.0030.00516.75
8.0.50.0000.00816.92
8.0.30.0160.00317.02
8.0.20.0130.01217.26
8.0.10.0040.00416.95
8.0.00.0130.00516.79
7.4.330.0000.00513.02
7.4.320.0000.00616.68
7.4.300.0030.00316.65
7.4.290.0080.00016.52
7.4.280.0000.00816.65
7.4.270.0070.00016.52
7.4.260.0060.00013.38
7.4.250.0000.00716.64
7.4.240.0000.00716.57
7.4.230.0070.00016.45
7.4.220.0110.00716.66
7.4.210.0030.01216.68
7.4.200.0000.00716.44
7.4.190.0000.00716.76
7.4.160.0110.00516.51
7.4.150.0070.01116.39
7.4.140.0070.01016.68
7.4.130.0100.01416.49
7.4.120.0030.01416.63
7.4.110.0140.00716.70
7.4.100.0060.01516.61
7.4.90.0100.01016.54
7.4.80.0090.01316.60
7.4.70.0140.00316.54
7.4.60.0130.00316.59
7.4.50.0000.01016.25
7.4.40.0120.00316.51
7.4.30.0030.01416.59
7.4.10.0080.00914.89
7.4.00.0070.01114.90
7.3.330.0030.00313.40
7.3.320.0000.00713.20
7.3.310.0040.00416.44
7.3.300.0030.00316.29
7.3.290.0070.00916.33
7.3.280.0130.00516.40
7.3.270.0130.01216.68
7.3.260.0070.01116.45
7.3.250.0100.00716.41
7.3.240.0150.00316.58
7.3.230.0140.00316.52
7.3.210.0080.00816.72
7.3.200.0040.01719.39
7.3.190.0150.00916.50
7.3.180.0160.00016.67
7.3.170.0100.00616.41
7.3.160.0060.01016.55
7.3.130.0110.00714.87
7.3.120.0080.00714.79
7.3.110.0090.00814.88
7.3.100.0090.00414.68
7.3.90.0050.01114.88
7.3.80.0050.00814.81
7.3.70.0050.00714.90
7.3.60.0050.00714.74
7.3.50.0030.00914.81
7.3.40.0070.00614.94
7.3.30.0080.00614.84
7.3.20.0050.00916.64
7.3.10.0040.01116.69
7.3.00.0110.00516.57
7.2.330.0060.01216.75
7.2.320.0130.01016.71
7.2.310.0120.00616.75
7.2.300.0070.01416.70
7.2.290.0130.01316.95
7.2.260.0080.01015.15
7.2.250.0100.01015.01
7.2.240.0060.00915.13
7.2.230.0080.00715.17
7.2.220.0070.00615.26
7.2.210.0070.00615.01
7.2.200.0050.00815.15
7.2.190.0040.01215.16
7.2.180.0030.00915.07
7.2.170.0070.00715.16
7.2.160.0060.00515.09
7.2.150.0050.01016.98
7.2.140.0090.00617.00
7.2.130.0070.00816.88
7.2.120.0080.00617.03
7.2.110.0080.00716.85
7.2.100.0060.00716.88
7.2.90.0080.00816.92
7.2.80.0050.00917.02
7.2.70.0070.00816.90
7.2.60.0080.00616.98
7.2.50.0090.00416.98
7.2.40.0080.00716.89
7.2.30.0060.00716.98
7.2.20.0080.00616.98
7.2.10.0090.00416.85
7.2.00.0060.00617.38
7.1.330.0040.01115.67
7.1.320.0060.00615.79
7.1.310.0070.00515.80
7.1.300.0050.00915.79
7.1.290.0070.00715.81
7.1.280.0060.00615.69
7.1.270.0080.00415.88
7.1.260.0040.01015.74
7.1.250.0050.00715.88
7.1.240.0010.00915.73
7.1.230.0040.01015.78
7.1.220.0020.00815.63
7.1.210.0030.00815.88
7.1.200.0040.00915.72
7.1.190.0030.01115.79
7.1.180.0040.00815.51
7.1.170.0020.00915.68
7.1.160.0030.00815.71
7.1.150.0060.00915.80
7.1.140.0000.01315.85
7.1.130.0060.00815.71
7.1.120.0050.00715.83
7.1.110.0050.00715.76
7.1.100.0050.00716.59
7.1.90.0020.01115.84
7.1.80.0050.00815.94
7.1.70.0060.00416.31
7.1.60.0060.00817.08
7.1.50.0040.01216.17
7.1.40.0000.01415.83
7.1.30.0020.01315.70
7.1.20.0100.00115.74
7.1.10.0030.00915.78
7.1.00.0060.02718.04
7.0.330.0090.00515.41
7.0.320.0030.00815.47
7.0.310.0080.00515.52
7.0.300.0040.00715.48
7.0.290.0060.00515.47
7.0.280.0020.01015.41
7.0.270.0110.00215.41
7.0.260.0050.00615.30
7.0.250.0040.00915.34
7.0.240.0050.01015.59
7.0.230.0070.00715.59
7.0.220.0030.00915.30
7.0.210.0070.00615.30
7.0.200.0080.00515.17
7.0.190.0030.00815.33
7.0.180.0030.00815.34
7.0.170.0020.01015.58
7.0.160.0040.00915.32
7.0.150.0060.00615.40
7.0.140.0080.02617.50
7.0.130.0040.01115.38
7.0.120.0040.02917.71
7.0.110.0070.00515.40
7.0.100.0070.00715.18
7.0.90.0040.00615.52
7.0.80.0010.01215.50
7.0.70.0090.00315.40
7.0.60.0060.02916.76
7.0.50.0040.01916.25
7.0.40.0060.01914.94
7.0.30.0050.03114.92
7.0.20.0040.02314.95
7.0.10.0080.02814.82
7.0.00.0050.03214.82
5.6.400.0080.00714.60
5.6.390.0080.00714.37
5.6.380.0070.00914.49
5.6.370.0020.00914.70
5.6.360.0040.00614.68
5.6.350.0070.00414.46
5.6.340.0060.00614.67
5.6.330.0020.01214.65
5.6.320.0050.00614.43
5.6.310.0050.00714.62
5.6.300.0060.00614.29
5.6.290.0090.00614.53
5.6.280.0040.03116.66
5.6.270.0040.00814.66
5.6.260.0080.00714.59
5.6.250.0100.00514.70
5.6.240.0080.00514.48
5.6.230.0060.00314.44
5.6.220.0060.00514.33
5.6.210.0070.03616.47
5.6.200.0090.03015.71
5.6.190.0070.02415.68
5.6.180.0050.03115.71
5.6.170.0050.03315.66
5.6.160.0050.03015.67
5.6.150.0090.02915.69
5.6.140.0050.02415.66
5.6.130.0040.02715.71
5.6.120.0040.02315.77
5.6.110.0040.03015.92
5.6.100.0070.02715.73
5.6.90.0020.02315.81
5.6.80.0000.02215.47
5.6.70.0060.02615.60
5.6.60.0080.03115.39
5.6.50.0090.01915.44
5.6.40.0050.03415.38
5.6.30.0080.02815.45
5.6.20.0060.03115.38
5.6.10.0040.02615.36
5.6.00.0060.02915.38
5.5.380.0080.00414.58
5.5.370.0030.01214.24
5.5.360.0100.00614.59
5.5.350.0100.02316.40
5.5.340.0100.02915.58
5.5.330.0040.02115.63
5.5.320.0080.02815.76
5.5.310.0050.03215.65
5.5.300.0040.03615.41
5.5.290.0060.02215.52
5.5.280.0080.01715.56
5.5.270.0070.01715.68
5.5.260.0090.02315.66
5.5.250.0050.03515.42
5.5.240.0090.01815.46
5.5.230.0070.02815.42
5.5.220.0060.01915.43
5.5.210.0060.02315.35
5.5.200.0110.01415.43
5.5.190.0030.03315.42
5.5.180.0060.02815.38
5.5.170.0070.00614.31
5.5.160.0080.01715.26
5.5.150.0080.02615.18
5.5.140.0100.02915.45
5.5.130.0050.02615.29
5.5.120.0050.02315.43
5.5.110.0050.03415.47
5.5.100.0040.02715.38
5.5.90.0070.02915.31
5.5.80.0070.02915.37
5.5.70.0070.03015.39
5.5.60.0070.02915.40
5.5.50.0080.03115.23
5.5.40.0070.03215.31
5.5.30.0070.03315.13
5.5.20.0090.03115.26
5.5.10.0040.03215.28
5.5.00.0060.01915.17
5.4.450.0060.01614.63
5.4.440.0070.01714.63
5.4.430.0040.03114.68
5.4.420.0080.02614.66
5.4.410.0040.02414.66
5.4.400.0050.02914.57
5.4.390.0090.03014.58
5.4.380.0090.03014.56
5.4.370.0060.02414.55
5.4.360.0070.02614.57
5.4.350.0030.02514.58
5.4.340.0070.02614.56
5.4.330.0060.00412.30
5.4.320.0030.01814.50
5.4.310.0060.01914.51
5.4.300.0070.02414.57
5.4.290.0050.03114.50
5.4.280.0050.03114.63
5.4.270.0080.02914.55
5.4.260.0070.02414.53
5.4.250.0080.02714.56
5.4.240.0040.03214.55
5.4.230.0050.02014.62
5.4.220.0040.02814.55
5.4.210.0030.03114.54
5.4.200.0070.03014.57
5.4.190.0030.03114.54
5.4.180.0060.02314.57
5.4.170.0020.02214.53
5.4.160.0040.01914.54
5.4.150.0070.02814.54
5.4.140.0100.02313.68
5.4.130.0060.02813.70
5.4.120.0080.01913.69
5.4.110.0020.02213.71
5.4.100.0040.02813.65
5.4.90.0040.02913.66
5.4.80.0060.01813.69
5.4.70.0050.01513.71
5.4.60.0030.03113.68
5.4.50.0050.03113.69
5.4.40.0030.02313.68
5.4.30.0060.01513.71
5.4.20.0050.01713.69
5.4.10.0080.02613.73
5.4.00.0060.02813.48
5.3.290.0040.02813.11
5.3.280.0070.01713.11
5.3.270.0060.01713.10
5.3.260.0060.01713.12
5.3.250.0060.01613.10
5.3.240.0030.02913.10
5.3.230.0080.02013.08
5.3.220.0090.03013.09
5.3.210.0070.03113.10
5.3.200.0090.01613.09
5.3.190.0030.03513.06
5.3.180.0030.02313.06
5.3.170.0030.01813.06
5.3.160.0060.02213.10
5.3.150.0020.02513.15
5.3.140.0110.01413.09
5.3.130.0100.01513.07
5.3.120.0040.02413.08
5.3.110.0090.02813.08
5.3.100.0040.02912.91
5.3.90.0060.02812.91
5.3.80.0060.02512.90
5.3.70.0040.01812.92
5.3.60.0050.01512.89
5.3.50.0010.03112.90
5.3.40.0030.02612.87
5.3.30.0050.01612.93
5.3.20.0050.02312.80
5.3.10.0020.02212.80
5.3.00.0060.02712.73
5.2.170.0030.05311.21
5.2.160.0070.02711.21
5.2.150.0030.03011.41
5.2.140.0030.04011.23
5.2.130.0070.03011.05
5.2.120.0000.03311.20
5.2.110.0070.06011.20
5.2.100.0030.06711.01
5.2.90.0030.06011.22
5.2.80.0070.05011.18
5.2.70.0070.06311.04
5.2.60.0030.06011.09
5.2.50.0100.04311.10
5.2.40.0000.06311.10
5.2.30.0070.06010.93
5.2.20.0030.05011.04
5.2.10.0030.05710.96
5.2.00.0030.03010.81
5.1.60.0000.03010.09
5.1.50.0070.0309.88
5.1.40.0030.05710.06
5.1.30.0070.03710.29
5.1.20.0100.05710.40
5.1.10.0030.04310.20
5.1.00.0100.05010.33
5.0.50.0000.0308.41
5.0.40.0030.0408.46
5.0.30.0000.0408.27
5.0.20.0030.0278.25
5.0.10.0030.0278.27
5.0.00.0070.0378.21
4.4.90.0000.0207.86
4.4.80.0030.0337.86
4.4.70.0030.0177.86
4.4.60.0030.0307.86
4.4.50.0000.0177.86
4.4.40.0000.0307.86
4.4.30.0000.0377.86
4.4.20.0000.0277.86
4.4.10.0000.0277.86
4.4.00.0030.0537.86
4.3.110.0030.0207.86
4.3.100.0000.0237.86
4.3.90.0030.0177.86
4.3.80.0000.0307.86
4.3.70.0000.0377.86
4.3.60.0030.0277.86
4.3.50.0030.0237.86
4.3.40.0070.0507.86
4.3.30.0000.0377.86
4.3.20.0100.0277.86
4.3.10.0070.0337.86
4.3.00.0000.0277.86

preferences:
83.82 ms | 401 KiB | 5 Q