3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ExtendedArrayObject extends ArrayObject { function offsetGet($offset) { echo "Called", 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.0130.00616.88
8.3.50.0140.00518.42
8.3.40.0090.00618.94
8.3.30.0090.00618.83
8.3.20.0080.00018.95
8.3.10.0060.00320.71
8.3.00.0040.00419.51
8.2.180.0110.00716.63
8.2.170.0110.00422.96
8.2.160.0170.00320.38
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0140.00026.16
8.2.120.0040.00420.66
8.2.110.0000.01021.10
8.2.100.0080.00417.84
8.2.90.0040.00419.39
8.2.80.0040.00417.97
8.2.70.0000.00817.50
8.2.60.0050.00517.55
8.2.50.0080.00018.10
8.2.40.0040.00418.22
8.2.30.0040.00418.19
8.2.20.0030.00619.50
8.2.10.0080.00017.70
8.2.00.0060.00317.77
8.1.280.0040.01125.92
8.1.270.0040.00424.66
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0040.00423.84
8.1.230.0070.00719.10
8.1.220.0040.00417.74
8.1.210.0030.00718.77
8.1.200.0090.00017.22
8.1.190.0030.00517.35
8.1.180.0030.00518.10
8.1.170.0040.00418.84
8.1.160.0050.00318.94
8.1.150.0000.00818.63
8.1.140.0030.00517.41
8.1.130.0070.00017.78
8.1.120.0030.00617.48
8.1.110.0000.00817.52
8.1.100.0000.00917.39
8.1.90.0000.00717.43
8.1.80.0040.00417.52
8.1.70.0000.00717.40
8.1.60.0030.00517.51
8.1.50.0000.00817.52
8.1.40.0040.00417.55
8.1.30.0080.00017.61
8.1.20.0000.00817.68
8.1.10.0000.00817.61
8.1.00.0050.00217.41
8.0.300.0000.00718.77
8.0.290.0000.00816.88
8.0.280.0070.00018.57
8.0.270.0030.00317.19
8.0.260.0000.00716.87
8.0.250.0040.00417.00
8.0.240.0000.00716.94
8.0.230.0040.00416.98
8.0.220.0000.00816.97
8.0.210.0040.00416.93
8.0.200.0060.00017.02
8.0.190.0000.00816.91
8.0.180.0040.00417.02
8.0.170.0040.00416.98
8.0.160.0050.00216.84
8.0.150.0030.00716.83
8.0.140.0000.00816.90
8.0.130.0000.00513.41
8.0.120.0000.00816.93
8.0.110.0050.00316.82
8.0.100.0080.00016.98
8.0.90.0040.00416.77
8.0.80.0060.00916.96
8.0.70.0040.00416.81
8.0.60.0030.00616.83
8.0.50.0030.00616.96
8.0.30.0070.01417.30
8.0.20.0060.01317.07
8.0.10.0000.00817.01
8.0.00.0090.01016.81
7.4.330.0000.00512.91
7.4.320.0060.00016.48
7.4.300.0000.00716.63
7.4.290.0050.00316.56
7.4.280.0090.00016.52
7.4.270.0030.00616.51
7.4.260.0030.00313.26
7.4.250.0000.00816.55
7.4.240.0030.00316.63
7.4.230.0060.00316.63
7.4.220.0090.00916.58
7.4.210.0050.01016.72
7.4.200.0000.00716.70
7.4.190.0000.00716.52
7.4.160.0080.00816.66
7.4.150.0120.01216.53
7.4.140.0180.00016.60
7.4.130.0090.00916.44
7.4.120.0060.01016.73
7.4.110.0060.01216.76
7.4.100.0140.00316.55
7.4.90.0040.01516.66
7.4.80.0130.00919.39
7.4.70.0120.00416.68
7.4.60.0070.01016.48
7.4.50.0060.00316.45
7.4.40.0060.01016.47
7.4.30.0090.00916.64
7.4.10.0100.01014.91
7.4.00.0050.01014.83
7.3.330.0030.00313.23
7.3.320.0000.00813.23
7.3.310.0030.00316.25
7.3.300.0000.00716.27
7.3.290.0050.01016.39
7.3.280.0080.00816.45
7.3.270.0090.00916.35
7.3.260.0110.00716.42
7.3.250.0050.01516.53
7.3.240.0030.01416.61
7.3.230.0070.01116.61
7.3.210.0070.01116.47
7.3.200.0060.01616.71
7.3.190.0130.01116.28
7.3.180.0090.01216.39
7.3.170.0060.01416.57
7.3.160.0120.00616.64
7.3.130.0080.01215.06
7.3.120.0090.00915.04
7.3.110.0110.00714.71
7.3.100.0030.01014.88
7.3.90.0060.00814.92
7.3.80.0030.01014.84
7.3.70.0060.01015.03
7.3.60.0090.00614.95
7.3.50.0000.01014.55
7.3.40.0040.01114.86
7.3.30.0000.01314.61
7.3.20.0030.00716.55
7.3.10.0060.00716.52
7.3.00.0040.00716.83
7.2.330.0060.01216.56
7.2.320.0030.01916.76
7.2.310.0130.01016.51
7.2.300.0090.01516.82
7.2.290.0110.01116.70
7.2.260.0070.01015.02
7.2.250.0060.01315.14
7.2.240.0070.00715.14
7.2.230.0070.01015.12
7.2.220.0030.00914.89
7.2.210.0000.01415.22
7.2.200.0030.01015.16
7.2.190.0100.00715.14
7.2.180.0000.00915.00
7.2.170.0040.01114.88
7.2.160.0040.01515.08
7.2.150.0110.00417.06
7.2.140.0060.00816.97
7.2.130.0000.01016.88
7.2.120.0120.00416.71
7.2.110.0060.00916.92
7.2.100.0060.00916.71
7.2.90.0070.01016.90
7.2.80.0110.00316.87
7.2.70.0060.00616.41
7.2.60.0090.00716.92
7.2.50.0030.01216.63
7.2.40.0040.00816.80
7.2.30.0060.01116.96
7.2.20.0100.00716.52
7.2.10.0050.00516.95
7.2.00.0070.00618.24
7.1.330.0040.01115.71
7.1.320.0060.00615.83
7.1.310.0060.00315.96
7.1.300.0060.00315.77
7.1.290.0040.00415.86
7.1.280.0040.01115.77
7.1.270.0040.00415.84
7.1.260.0070.00415.86
7.1.250.0000.00815.52
7.1.240.0000.01115.77
7.1.230.0000.01515.87
7.1.220.0030.01015.61
7.1.210.0040.00915.55
7.1.200.0020.00915.80
7.1.190.0110.00015.90
7.1.180.0000.01015.69
7.1.170.0070.01015.80
7.1.160.0080.00515.67
7.1.150.0060.01215.86
7.1.140.0070.01015.50
7.1.130.0070.00715.66
7.1.120.0000.01715.74
7.1.110.0060.00615.79
7.1.100.0060.01116.90
7.1.90.0000.01315.80
7.1.80.0000.01415.86
7.1.70.0040.00816.49
7.1.60.0090.01117.47
7.1.50.0050.01516.44
7.1.40.0040.01115.54
7.1.30.0060.00615.64
7.1.20.0130.00315.75
7.1.10.0070.01015.47
7.1.00.0060.04319.17
7.0.330.0030.00615.08
7.0.320.0100.00315.50
7.0.310.0040.01315.47
7.0.300.0100.00315.32
7.0.290.0000.01315.00
7.0.280.0030.01015.39
7.0.270.0030.01014.81
7.0.260.0110.00315.27
7.0.250.0030.01015.39
7.0.240.0030.01015.04
7.0.230.0040.01115.48
7.0.220.0060.00615.52
7.0.210.0040.00815.52
7.0.200.0180.00815.21
7.0.190.0030.01315.41
7.0.180.0080.00815.17
7.0.170.0030.01015.34
7.0.160.0030.01215.46
7.0.150.0070.01115.20
7.0.140.0120.03318.73
7.0.130.0030.01015.30
7.0.120.0030.02818.75
7.0.110.0000.01815.38
7.0.100.0100.00015.32
7.0.90.0060.00915.25
7.0.80.0100.00315.33
7.0.70.0000.01315.29
7.0.60.0050.02018.61
7.0.50.0070.04516.64
7.0.40.0100.02015.54
7.0.30.0050.02515.60
7.0.20.0060.03015.59
7.0.10.0080.04015.57
7.0.00.0070.02815.44
5.6.400.0060.00314.48
5.6.390.0120.00614.43
5.6.380.0120.00614.42
5.6.370.0080.00414.28
5.6.360.0030.00614.38
5.6.350.0030.00614.27
5.6.340.0040.00814.52
5.6.330.0000.01514.61
5.6.320.0070.00714.88
5.6.310.0030.00914.04
5.6.300.0150.00014.27
5.6.290.0060.00914.42
5.6.280.0020.04417.68
5.6.270.0060.00914.45
5.6.260.0070.00714.05
5.6.250.0060.00614.40
5.6.240.0090.00514.23
5.6.230.0100.00314.65
5.6.220.0070.01014.22
5.6.210.0090.03017.47
5.6.200.0080.04016.33
5.6.190.0050.04216.30
5.6.180.0050.02616.39
5.6.170.0030.04816.33
5.6.160.0050.04716.31
5.6.150.0020.02816.35
5.6.140.0110.02916.28
5.6.130.0030.03016.30
5.6.120.0070.02416.25
5.6.110.0110.03016.36
5.6.100.0050.03916.19
5.6.90.0110.04116.33
5.6.80.0060.02815.77
5.6.70.0100.03315.89
5.6.60.0100.04015.90
5.6.50.0050.03415.92
5.6.40.0100.03015.95
5.6.30.0110.03515.86
5.6.20.0100.03715.94
5.6.10.0020.03415.90
5.6.00.0050.04615.93
5.5.380.0030.01614.23
5.5.370.0100.00314.13
5.5.360.0070.00414.41
5.5.350.0060.03117.26
5.5.340.0060.03816.26
5.5.330.0150.02116.18
5.5.320.0080.02216.17
5.5.310.0080.03716.20
5.5.300.0070.04316.08
5.5.290.0000.05216.03
5.5.280.0070.04616.24
5.5.270.0030.05416.07
5.5.260.0100.03216.07
5.5.250.0090.03515.96
5.5.240.0080.02215.92
5.5.230.0030.04615.81
5.5.220.0050.04216.02
5.5.210.0070.03715.84
5.5.200.0070.04215.82
5.5.190.0030.03315.77
5.5.180.0130.03515.70
5.5.170.0070.00713.89
5.5.160.0040.04115.80
5.5.150.0030.03415.88
5.5.140.0080.02015.79
5.5.130.0020.02715.97
5.5.120.0000.02915.69
5.5.110.0190.01516.02
5.5.100.0100.02115.68
5.5.90.0070.01915.82
5.5.80.0070.02015.82
5.5.70.0080.02015.70
5.5.60.0050.03215.67
5.5.50.0070.02015.79
5.5.40.0050.04515.79
5.5.30.0030.02315.77
5.5.20.0090.02015.70
5.5.10.0020.02715.66
5.5.00.0020.02615.83
5.4.450.0040.04415.40
5.4.440.0070.03115.15
5.4.430.0070.03715.19
5.4.420.0090.04215.37
5.4.410.0020.04815.24
5.4.400.0060.02315.21
5.4.390.0070.04114.85
5.4.380.0030.02615.05
5.4.370.0110.03414.94
5.4.360.0010.02815.03
5.4.350.0090.03914.90
5.4.340.0080.04015.08
5.4.330.0030.00910.91
5.4.320.0130.01915.05
5.4.310.0050.02215.03
5.4.300.0060.02014.87
5.4.290.0150.01714.96
5.4.280.0030.02114.92
5.4.270.0060.02114.94
5.4.260.0050.02114.93
5.4.250.0050.02215.07
5.4.240.0000.02715.23
5.4.230.0040.02414.95
5.4.220.0050.04415.23
5.4.210.0080.02615.02
5.4.200.0070.02715.00
5.4.190.0000.03214.96
5.4.180.0040.02614.85
5.4.170.0060.02215.02
5.4.160.0120.01515.00
5.4.150.0100.01614.93
5.4.140.0040.02113.76
5.4.130.0070.01713.81
5.4.120.0080.01813.94
5.4.110.0030.02113.89
5.4.100.0090.01813.94
5.4.90.0060.02213.86
5.4.80.0060.02113.87
5.4.70.0080.01813.79
5.4.60.0040.02413.75
5.4.50.0030.02113.76
5.4.40.0010.02113.84
5.4.30.0020.02213.79
5.4.20.0030.01913.89
5.4.10.0000.03213.70
5.4.00.0150.02013.54
5.3.290.0030.04012.78
5.3.280.0050.02212.69
5.3.270.0050.02112.69
5.3.260.0070.02012.70
5.3.250.0020.02212.59
5.3.240.0040.02212.52
5.3.230.0030.02312.52
5.3.220.0050.02012.63
5.3.210.0040.02312.62
5.3.200.0020.02212.65
5.3.190.0020.02712.72
5.3.180.0030.02612.71
5.3.170.0010.02312.53
5.3.160.0030.02112.71
5.3.150.0020.02312.72
5.3.140.0020.02112.58
5.3.130.0060.02212.62
5.3.120.0050.02012.69
5.3.110.0000.02612.57
5.3.100.0030.04312.30
5.3.90.0060.03512.44
5.3.80.0010.04312.31
5.3.70.0050.03712.46
5.3.60.0030.04312.38
5.3.50.0070.02512.29
5.3.40.0000.03012.15
5.3.30.0070.02712.36
5.3.20.0020.04512.23
5.3.10.0050.04012.08
5.3.00.0070.03812.05
5.2.170.0030.05311.24
5.2.160.0070.06011.25
5.2.150.0030.03011.29
5.2.140.0030.06311.18
5.2.130.0030.04011.11
5.2.120.0100.04011.16
5.2.110.0000.06011.18
5.2.100.0070.03311.25
5.2.90.0070.04711.16
5.2.80.0100.05311.19
5.2.70.0070.04011.18
5.2.60.0070.03311.17
5.2.50.0070.06010.96
5.2.40.0030.06010.94
5.2.30.0030.04711.01
5.2.20.0030.06011.02
5.2.10.0030.05310.97
5.2.00.0030.06010.86
5.1.60.0100.04710.39
5.1.50.0030.02710.39
5.1.40.0070.04710.39
5.1.30.0070.04710.43
5.1.20.0030.04710.51
5.1.10.0000.06010.39
5.1.00.0070.05310.39
5.0.50.0000.05010.39
5.0.40.0000.04310.39
5.0.30.0000.03310.39
5.0.20.0070.02010.39
5.0.10.0030.03010.39
5.0.00.0070.04010.39
4.4.90.0030.02010.39
4.4.80.0000.02310.39
4.4.70.0030.03710.39
4.4.60.0030.03310.39
4.4.50.0000.03710.39
4.4.40.0030.04710.39
4.4.30.0030.02310.39
4.4.20.0000.02010.39
4.4.10.0000.03310.39
4.4.00.0030.04310.39
4.3.110.0000.02710.39
4.3.100.0030.02710.39
4.3.90.0030.01710.39
4.3.80.0030.03010.39
4.3.70.0030.01710.39
4.3.60.0070.01710.39
4.3.50.0030.01310.39
4.3.40.0030.05010.39
4.3.30.0000.02010.39
4.3.20.0030.01710.39
4.3.10.0030.01710.39
4.3.00.0030.02010.39

preferences:
47.21 ms | 401 KiB | 5 Q