3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ExtendedArrayObject extends ArrayObject { function offsetExists($offset) { //echo "\t", __METHOD__, PHP_EOL; return parent::offsetExists($offset); } function offsetGet($offset) { //echo "\t", __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, $array); } function empty_existing_key_with_not_empty_value($array) { $array['foo'] = 1; $this->expect(empty($array['foo']) === false, $array); } function isset_existing_key_with_empty_value($array) { $array['foo'] = 0; $this->expect(isset($array['foo']) === true, $array); } function empty_existing_key_with_empty_value($array) { $array['foo'] = 0; $this->expect(empty($array['foo']) === true, $array); } function isset_non_existent_key($array) { $this->expect(isset($array['foo']) === false, $array); } function empty_non_existent_key($array) { $this->expect(empty($array['foo']) === true, $array); } function isset_existing_key_with_null_value($array) { $array['foo'] = null; $this->expect(isset($array['foo']) === false, $array); } function empty_existing_key_with_null_value($array) { $array['foo'] = null; $this->expect(empty($array['foo']) === true, $array); } private function getType($v) { return is_array($v) ? 'array' : get_class($v); } private function expect($condition, $array) { if (!$condition) { echo "\t", $this->getType($array), ' failed ', 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.0180.00417.00
8.3.50.0080.01316.80
8.3.40.0120.00618.79
8.3.30.0070.00718.97
8.3.20.0120.00418.90
8.3.10.0040.00418.82
8.3.00.0080.00019.38
8.2.180.0080.01225.92
8.2.170.0180.00419.09
8.2.160.0110.00422.96
8.2.150.0040.00425.66
8.2.140.0030.00524.66
8.2.130.0090.00326.16
8.2.120.0080.00021.18
8.2.110.0000.01020.52
8.2.100.0090.00317.91
8.2.90.0030.00519.14
8.2.80.0040.00419.38
8.2.70.0060.00317.75
8.2.60.0050.00318.04
8.2.50.0050.00318.07
8.2.40.0050.00318.34
8.2.30.0050.00219.38
8.2.20.0030.00617.82
8.2.10.0050.00317.66
8.2.00.0100.00017.88
8.1.270.0040.00424.66
8.1.260.0040.00426.35
8.1.250.0030.00628.09
8.1.240.0070.00323.92
8.1.230.0110.00020.97
8.1.220.0040.00418.77
8.1.210.0090.00018.96
8.1.200.0090.00017.25
8.1.190.0030.00517.53
8.1.180.0000.00818.10
8.1.170.0000.00818.50
8.1.160.0060.00318.91
8.1.150.0000.00818.68
8.1.140.0040.00417.40
8.1.130.0000.00717.81
8.1.120.0000.00817.51
8.1.110.0030.00517.47
8.1.100.0040.00317.48
8.1.90.0040.00417.42
8.1.80.0000.00717.39
8.1.70.0000.00717.52
8.1.60.0040.00417.63
8.1.50.0030.00517.52
8.1.40.0040.00417.55
8.1.30.0090.00017.57
8.1.20.0000.00817.52
8.1.10.0000.00817.66
8.1.00.0040.00417.52
8.0.300.0070.00319.91
8.0.290.0040.00417.16
8.0.280.0000.00718.49
8.0.270.0000.00716.76
8.0.260.0000.00616.73
8.0.250.0040.00417.01
8.0.240.0030.00617.05
8.0.230.0000.00817.00
8.0.220.0000.00716.97
8.0.210.0080.00016.94
8.0.200.0070.00017.02
8.0.190.0000.00717.03
8.0.180.0030.01116.96
8.0.170.0090.00016.88
8.0.160.0000.00816.97
8.0.150.0050.00316.91
8.0.140.0000.00816.92
8.0.130.0000.00613.35
8.0.120.0050.00316.89
8.0.110.0000.00816.83
8.0.100.0030.00316.94
8.0.90.0080.00016.74
8.0.80.0050.01016.88
8.0.70.0040.00416.80
8.0.60.0050.00316.81
8.0.50.0050.00216.88
8.0.30.0090.00917.35
8.0.20.0110.00917.04
8.0.10.0020.00517.11
8.0.00.0100.01116.69
7.4.330.0060.00012.97
7.4.320.0000.00616.42
7.4.300.0000.00616.63
7.4.290.0000.00716.63
7.4.280.0060.00316.55
7.4.270.0040.00416.54
7.4.260.0080.00016.56
7.4.250.0050.00316.55
7.4.240.0060.00216.49
7.4.230.0040.00416.29
7.4.220.0040.01516.50
7.4.210.0080.00916.66
7.4.200.0050.00316.71
7.4.190.0070.00016.71
7.4.160.0070.01016.70
7.4.150.0120.00616.55
7.4.140.0080.00816.51
7.4.130.0090.00916.48
7.4.120.0080.01016.48
7.4.110.0100.00716.49
7.4.100.0110.00816.80
7.4.90.0150.00316.48
7.4.80.0060.01219.39
7.4.70.0060.01216.57
7.4.60.0030.01316.52
7.4.50.0130.00016.59
7.4.40.0120.00016.45
7.4.30.0130.00316.58
7.4.00.0080.00715.04
7.3.330.0060.00013.26
7.3.320.0060.00013.37
7.3.310.0000.00816.29
7.3.300.0050.00216.39
7.3.290.0060.00816.37
7.3.280.0120.00816.39
7.3.270.0040.01316.34
7.3.260.0140.00716.44
7.3.250.0050.01416.55
7.3.240.0000.01716.53
7.3.230.0070.01016.33
7.3.210.0100.00716.58
7.3.200.0030.01416.45
7.3.190.0100.01016.47
7.3.180.0080.00816.31
7.3.170.0090.00916.39
7.3.160.0120.00416.41
7.3.120.0050.01014.70
7.3.110.0030.01414.62
7.3.100.0090.00314.88
7.3.90.0040.00714.90
7.3.80.0050.00414.78
7.3.70.0070.00514.76
7.3.60.0060.00814.65
7.3.50.0070.01014.87
7.3.40.0060.00914.53
7.3.30.0080.00514.85
7.3.20.0050.01016.64
7.3.10.0060.00616.67
7.3.00.0100.00616.50
7.2.330.0140.01016.86
7.2.320.0060.01216.68
7.2.310.0140.01016.70
7.2.300.0030.01616.61
7.2.290.0120.00616.79
7.2.250.0100.00815.11
7.2.240.0110.00615.26
7.2.230.0050.01015.21
7.2.220.0020.00914.90
7.2.210.0010.01315.03
7.2.200.0020.01215.12
7.2.190.0080.00415.14
7.2.180.0060.01014.96
7.2.170.0080.00814.91
7.2.130.0040.00716.80
7.2.120.0030.01117.13
7.2.110.0030.00916.68
7.2.100.0110.00316.93
7.2.90.0080.00616.82
7.2.80.0110.00416.91
7.2.70.0070.00416.56
7.2.60.0050.00816.83
7.2.50.0070.00716.96
7.2.40.0030.00917.16
7.2.30.0040.00417.11
7.2.20.0060.00616.98
7.2.10.0060.00316.79
7.2.00.0000.01117.05
7.1.330.0050.00915.82
7.1.320.0030.00815.80
7.1.310.0020.01015.67
7.1.300.0050.00815.63
7.1.290.0100.00515.65
7.1.280.0060.00615.86
7.1.270.0070.00715.70
7.1.260.0030.01015.69
7.1.250.0040.00715.68
7.1.240.0070.00315.70
7.1.230.0000.01015.58
7.1.220.0090.00315.71
7.1.210.0000.01415.68
7.1.200.0080.00615.59
7.1.190.0060.00615.96
7.1.180.0090.00615.95
7.1.170.0050.00515.75
7.1.160.0090.00315.76
7.1.150.0030.01015.95
7.1.140.0090.00615.72
7.1.130.0060.00615.79
7.1.120.0030.01015.98
7.1.110.0100.00315.95
7.1.100.0050.00515.92
7.1.90.0000.01015.60
7.1.80.0050.00315.50
7.1.70.0050.00516.63
7.1.60.0050.01417.61
7.1.50.0060.01116.40
7.1.40.0000.00915.61
7.1.30.0060.00615.65
7.1.20.0110.00415.79
7.1.10.0000.01715.73
7.1.00.0050.01819.10
7.0.330.0070.00715.35
7.0.320.0000.00915.48
7.0.310.0090.00315.50
7.0.300.0030.00915.34
7.0.290.0030.01015.50
7.0.280.0000.01015.34
7.0.270.0100.00015.39
7.0.260.0090.00015.47
7.0.250.0030.00715.34
7.0.240.0080.00415.30
7.0.230.0000.01115.39
7.0.220.0040.00415.50
7.0.210.0060.00315.28
7.0.200.0120.00515.29
7.0.190.0040.00815.34
7.0.180.0030.00715.38
7.0.170.0090.00315.24
7.0.160.0090.00315.38
7.0.150.0100.00315.12
7.0.140.0070.03718.61
7.0.130.0070.00715.18
7.0.120.0050.03918.69
7.0.110.0090.00415.16
7.0.100.0030.01015.43
7.0.90.0070.00415.41
7.0.80.0090.00615.37
7.0.70.0000.01115.14
7.0.60.0080.04117.61
7.0.50.0050.03116.71
7.0.40.0070.03215.56
7.0.30.0050.04215.72
7.0.20.0050.02515.58
7.0.10.0110.01815.66
7.0.00.0090.02015.69
5.6.380.0110.00414.51
5.6.370.0060.00614.46
5.6.360.0000.01114.45
5.6.350.0050.00214.46
5.6.340.0120.00314.16
5.6.330.0070.00314.51
5.6.320.0030.01014.33
5.6.310.0110.00414.24
5.6.300.0090.00614.40
5.6.290.0090.00314.46
5.6.280.0030.04017.71
5.6.270.0090.00614.48
5.6.260.0030.01314.60
5.6.250.0040.01114.45
5.6.240.0090.00314.72
5.6.230.0090.00614.72
5.6.220.0040.00714.21
5.6.210.0040.04417.45
5.6.200.0030.03016.32
5.6.190.0070.02816.20
5.6.180.0050.03516.25
5.6.170.0050.04216.16
5.6.160.0110.03716.36
5.6.150.0030.02816.32
5.6.140.0090.03916.25
5.6.130.0030.04116.40
5.6.120.0090.02516.32
5.6.110.0050.02816.34
5.6.100.0030.05016.33
5.6.90.0040.02816.19
5.6.80.0110.03315.95
5.6.70.0050.03016.00
5.6.60.0110.02815.87
5.6.50.0070.03515.91
5.6.40.0070.04315.83
5.6.30.0050.04515.92
5.6.20.0100.03815.87
5.6.10.0030.04615.96
5.6.00.0070.02815.99
5.5.380.0030.00911.19
5.5.370.0030.00711.30
5.5.360.0030.00611.43
5.5.350.0100.04315.79
5.5.340.0050.04114.67
5.5.330.0050.02714.57
5.5.320.0020.04514.61
5.5.310.0050.02314.73
5.5.300.0070.02614.70
5.5.290.0030.04014.59
5.5.280.0050.02514.66
5.5.270.0070.03914.68
5.5.260.0100.04214.59
5.5.250.0050.04014.49
5.5.240.0100.02314.28
5.5.230.0030.04314.29
5.5.220.0060.02914.29
5.5.210.0050.04014.33
5.5.200.0030.03514.36
5.5.190.0080.02614.39
5.5.180.0040.03114.28
5.5.170.0060.00611.43
5.5.160.0030.02614.32
5.5.150.0070.04314.29
5.5.140.0050.04014.30
5.5.130.0000.02714.29
5.5.120.0070.03814.27
5.5.110.0070.03514.29
5.5.100.0040.04114.20
5.5.90.0020.03114.21
5.5.80.0050.02214.33
5.5.70.0030.02214.25
5.5.60.0030.02314.22
5.5.50.0050.01914.20
5.5.40.0030.02114.21
5.5.30.0050.02014.25
5.5.20.0010.02314.22
5.5.10.0070.02014.25
5.5.00.0020.02414.19
5.4.450.0030.04515.28
5.4.440.0130.03615.31
5.4.430.0030.04415.27
5.4.420.0060.02615.26
5.4.410.0020.03615.26
5.4.400.0030.02515.11
5.4.390.0070.03915.09
5.4.380.0080.02215.15
5.4.370.0000.03215.10
5.4.360.0050.02915.07
5.4.350.0060.02115.21
5.4.340.0050.04215.04
5.4.330.0050.00311.18
5.4.320.0070.02815.12
5.4.310.0070.04015.07
5.4.300.0040.02815.06
5.4.290.0050.03515.11
5.4.280.0060.02415.15
5.4.270.0120.03215.13
5.4.260.0070.03215.14
5.4.250.0100.02315.10
5.4.240.0040.02015.08
5.4.230.0020.02415.10
5.4.220.0030.02115.10
5.4.210.0010.02615.14
5.4.200.0050.02015.13
5.4.190.0090.01715.11
5.4.180.0040.02115.18
5.4.170.0020.02215.10
5.4.160.0050.02015.19
5.4.150.0040.02015.02
5.4.140.0080.01713.96
5.4.130.0020.02113.83
5.4.120.0050.01813.73
5.4.110.0020.02213.83
5.4.100.0020.02013.92
5.4.90.0030.02013.91
5.4.80.0040.01813.82
5.4.70.0020.02313.91
5.4.60.0050.01713.81
5.4.50.0020.02213.76
5.4.40.0110.01513.80
5.4.30.0040.02213.83
5.4.20.0030.02013.73
5.4.10.0030.02013.78
5.4.00.0080.01813.50
5.3.290.0070.02712.92
5.3.280.0030.02412.84
5.3.270.0030.02012.90
5.3.260.0130.01612.96
5.3.250.0030.01812.90
5.3.240.0020.02212.90
5.3.230.0030.02312.84
5.3.220.0000.02212.89
5.3.210.0030.02012.89
5.3.200.0000.02412.88
5.3.190.0050.02012.90
5.3.180.0040.02012.93
5.3.170.0020.02212.95
5.3.160.0030.01912.92
5.3.150.0000.02312.91
5.3.140.0020.02012.91
5.3.130.0120.02312.91
5.3.120.0050.01812.94
5.3.110.0010.02612.81
5.3.100.0020.02212.66
5.3.90.0030.02012.61
5.3.80.0000.02312.56
5.3.70.0060.01812.64
5.3.60.0080.01812.56
5.3.50.0060.01712.60
5.3.40.0050.02312.69
5.3.30.0030.02612.59
5.3.20.0040.02112.49
5.3.10.0040.03412.46
5.3.00.0080.02712.45
5.2.170.0020.01711.13
5.2.160.0010.01611.18
5.2.150.0000.02011.17
5.2.140.0020.02611.20
5.2.130.0050.02211.19
5.2.120.0070.01511.19
5.2.110.0070.02811.16
5.2.100.0050.02911.27
5.2.90.0050.03411.16
5.2.80.0060.03111.19
5.2.70.0060.03111.18
5.2.60.0050.02211.12
5.2.50.0050.02011.13
5.2.40.0030.02211.03
5.2.30.0020.01711.02
5.2.20.0030.01511.09
5.2.10.0020.02211.15
5.2.00.0040.03010.99
5.1.60.0050.02510.61
5.1.50.0020.03110.57
5.1.40.0030.03110.59
5.1.30.0040.02710.80
5.1.20.0030.03110.84
5.1.10.0020.02710.63
5.1.00.0020.03110.64
5.0.50.0000.0169.85
5.0.40.0000.0219.81
5.0.30.0030.0209.80
5.0.20.0000.0159.80
5.0.10.0030.0259.80
5.0.00.0030.0259.80
4.4.90.0060.0159.80
4.4.80.0020.0129.80
4.4.70.0000.0209.80
4.4.60.0030.0159.80
4.4.50.0020.0189.80
4.4.40.0050.0279.80
4.4.30.0020.0139.80
4.4.20.0000.0249.80
4.4.10.0030.0109.80
4.4.00.0020.0159.80
4.3.110.0000.0109.80
4.3.100.0000.0119.80
4.3.90.0030.0189.80
4.3.80.0010.0259.80
4.3.70.0030.0099.80
4.3.60.0000.0219.80
4.3.50.0050.0169.80
4.3.40.0030.0289.80
4.3.30.0030.0129.80
4.3.20.0010.0219.80
4.3.10.0050.0179.80
4.3.00.0030.0189.80

preferences:
53.37 ms | 400 KiB | 5 Q