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]); } } $inputs = array( 'array' => array(), 'ExtendedArrayObject' => new ExtendedArrayObject(), 'ExtendedArrayAccess' => new ExtendedArrayAccess(), ); class Tests { function test_existing_key_with_not_empty_value($array) { $array['foo'] = 1; $this->expect(isset($array['foo']) === true, __FUNCTION__, $array); $this->expect(empty($array['foo']) === false, __FUNCTION__, $array); } function test_existing_key_with_empty_value($array) { $array['foo'] = 0; $this->expect(isset($array['foo']) === true, __FUNCTION__, $array); $this->expect(empty($array['foo']) === true, __FUNCTION__, $array); } function test_non_existent_key($array) { $this->expect(isset($array['foo']) === true, __FUNCTION__, $array); $this->expect(empty($array['foo']) === false, __FUNCTION__, $array); } function test_existing_key_with_null_value($array) { $array['foo'] = null; $this->expect(isset($array['foo']) === false, __FUNCTION__, $array); $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 ($inputs 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.0120.00618.43
8.3.50.0130.01021.97
8.3.40.0150.00018.87
8.3.30.0100.00720.21
8.3.20.0030.00520.20
8.3.10.0050.00322.15
8.3.00.0040.00422.48
8.2.180.0150.00018.29
8.2.170.0090.00622.96
8.2.160.0130.00720.52
8.2.150.0100.00024.18
8.2.140.0100.00024.66
8.2.130.0130.00026.16
8.2.120.0080.00019.52
8.2.110.0030.00620.31
8.2.100.0040.00819.34
8.2.90.0050.00319.25
8.2.80.0000.00819.34
8.2.70.0000.00817.75
8.2.60.0000.00817.93
8.2.50.0040.00418.07
8.2.40.0000.00818.16
8.2.30.0030.00518.02
8.2.20.0050.00317.65
8.2.10.0030.00517.73
8.2.00.0080.00017.71
8.1.280.0170.00325.92
8.1.270.0040.00424.66
8.1.260.0050.00326.35
8.1.250.0000.00728.09
8.1.240.0060.00323.98
8.1.230.0090.00318.96
8.1.220.0040.00417.74
8.1.210.0030.00518.77
8.1.200.0030.00717.25
8.1.190.0040.00417.63
8.1.180.0050.00220.15
8.1.170.0040.00418.62
8.1.160.0040.00422.08
8.1.150.0040.00418.59
8.1.140.0030.00517.48
8.1.130.0030.00317.86
8.1.120.0040.00417.43
8.1.110.0000.00817.44
8.1.100.0080.00017.41
8.1.90.0040.00417.37
8.1.80.0000.00717.52
8.1.70.0040.00417.38
8.1.60.0040.00417.48
8.1.50.0060.00317.53
8.1.40.0000.00917.45
8.1.30.0000.00817.67
8.1.20.0080.00017.65
8.1.10.0030.00617.49
8.1.00.0050.00317.46
8.0.300.0050.00318.77
8.0.290.0000.00717.05
8.0.280.0040.00418.48
8.0.270.0040.00417.29
8.0.260.0030.00316.75
8.0.250.0070.00016.87
8.0.240.0050.00316.98
8.0.230.0030.00316.95
8.0.220.0070.00016.81
8.0.210.0030.00316.82
8.0.200.0000.00716.85
8.0.190.0000.00716.95
8.0.180.0030.00716.80
8.0.170.0080.00016.95
8.0.160.0070.00016.79
8.0.150.0040.00416.78
8.0.140.0030.00516.90
8.0.130.0030.00313.35
8.0.120.0030.00716.93
8.0.110.0040.00416.84
8.0.100.0040.00416.74
8.0.90.0050.00316.75
8.0.80.0110.00416.91
8.0.70.0070.00016.94
8.0.60.0000.00716.96
8.0.50.0020.00516.86
8.0.30.0130.00617.23
8.0.20.0090.01217.40
8.0.10.0040.00416.89
8.0.00.0080.01116.69
7.4.330.0050.00015.00
7.4.320.0070.00016.64
7.4.300.0000.00816.62
7.4.290.0070.00016.66
7.4.280.0070.00016.63
7.4.270.0030.00316.66
7.4.260.0030.00516.66
7.4.250.0000.00716.59
7.4.240.0030.00516.53
7.4.230.0030.00316.72
7.4.220.0150.00316.70
7.4.210.0090.00716.54
7.4.200.0000.00716.46
7.4.190.0000.00916.52
7.4.160.0150.00316.66
7.4.150.0110.00717.40
7.4.140.0080.01117.86
7.4.130.0060.01116.56
7.4.120.0140.00616.58
7.4.110.0150.00316.47
7.4.100.0100.01416.63
7.4.90.0030.01416.58
7.4.80.0130.00719.39
7.4.70.0090.00916.64
7.4.60.0030.01416.46
7.4.50.0040.00416.54
7.4.40.0070.01122.77
7.4.30.0120.00416.48
7.4.00.0070.01014.71
7.3.330.0050.00013.38
7.3.320.0000.00513.40
7.3.310.0040.00416.45
7.3.300.0000.00716.34
7.3.290.0040.01216.34
7.3.280.0110.00616.37
7.3.270.0110.00717.40
7.3.260.0110.00716.64
7.3.250.0090.00916.44
7.3.240.0000.01816.40
7.3.230.0160.00616.56
7.3.210.0140.00316.41
7.3.200.0030.01319.39
7.3.190.0070.01016.37
7.3.180.0090.00616.41
7.3.170.0070.01016.45
7.3.160.0030.01316.66
7.3.120.0000.01815.05
7.3.10.0070.00716.48
7.3.00.0000.01116.73
7.2.330.0060.01216.91
7.2.320.0060.01316.85
7.2.310.0150.00716.71
7.2.300.0150.00416.66
7.2.290.0170.00016.87
7.2.130.0040.01116.94
7.2.120.0080.00616.84
7.2.110.0030.01316.80
7.2.100.0060.00916.96
7.2.90.0030.00716.95
7.2.80.0090.00616.65
7.2.70.0030.00916.78
7.2.60.0090.00616.79
7.2.50.0060.00916.88
7.2.40.0030.01016.92
7.2.30.0040.00817.06
7.2.20.0100.00316.91
7.2.10.0060.00616.84
7.2.00.0100.00016.82
7.1.250.0040.01515.93
7.1.200.0000.01215.81
7.1.70.0000.00717.03
7.1.60.0070.01419.43
7.1.50.0130.01016.91
7.1.00.0030.03322.25
7.0.200.0000.00816.83
7.0.140.0030.07322.18
7.0.60.0030.05719.82
7.0.50.0100.08017.86
7.0.40.0030.04320.05
7.0.30.0300.07720.23
7.0.20.0300.08720.02
7.0.10.0170.08720.37
7.0.00.0070.05320.20
5.6.280.0070.07021.02
5.6.210.0070.08020.55
5.6.200.0070.04018.29
5.6.190.0030.09320.45
5.6.180.0230.05020.77
5.6.170.0370.07020.51
5.6.160.0070.08020.52
5.6.150.0100.08018.18
5.6.140.0100.05018.14
5.6.130.0030.04018.19
5.6.120.0030.08021.02
5.6.110.0000.06021.12
5.6.100.0030.04021.13
5.6.90.0170.06721.14
5.6.80.0070.07020.45
5.6.70.0130.03720.38
5.5.350.0100.04020.43
5.5.340.0130.07317.97
5.5.330.0070.06320.34
5.5.320.0200.04320.31
5.5.310.0330.03720.23
5.5.300.0130.07318.08
5.5.290.0030.05718.07
5.5.280.0070.06020.71
5.5.270.0070.04320.82
5.5.260.0070.04720.79
5.5.250.0130.07020.73
5.5.240.0030.04320.15
5.4.450.0670.06019.47
5.4.440.0770.06019.38
5.4.430.0670.06719.63
5.4.420.1000.06319.69
5.4.410.0970.05319.33
5.4.400.0430.05018.82
5.4.390.0530.05318.62
5.4.380.0230.05318.80
5.4.370.0170.05018.55
5.4.360.0230.06018.61
5.4.350.0070.03912.04
5.4.340.0060.04012.04
5.4.320.0050.04012.53
5.4.310.0080.03912.53
5.4.300.0040.03912.53
5.4.290.0070.03712.52
5.4.280.0060.03812.39
5.4.270.0030.04012.39
5.4.260.0050.04012.39
5.4.250.0030.04412.39
5.4.240.0040.03812.40
5.4.230.0050.03912.38
5.4.220.0050.03812.39
5.4.210.0090.03412.39
5.4.200.0090.03412.39
5.4.190.0060.03612.38
5.4.180.0060.04812.38
5.4.170.0050.03812.39
5.4.160.0050.03712.39
5.4.150.0100.03312.39
5.4.140.0070.03712.07
5.4.130.0080.03412.05
5.4.120.0060.03512.02
5.4.110.0060.03512.01
5.4.100.0080.03412.01
5.4.90.0070.04212.01
5.4.80.0070.04012.01
5.4.70.0070.03512.01
5.4.60.0080.03912.01
5.4.50.0060.03812.01
5.4.40.0080.03812.00
5.4.30.0070.05012.00
5.4.20.0080.03812.00
5.4.10.0050.03911.99
5.4.00.0080.04911.48
5.3.290.0040.04912.80
5.3.280.0120.04912.71
5.3.270.0120.05112.73
5.3.260.0100.03912.72
5.3.250.0070.03712.71
5.3.240.0090.03512.71
5.3.230.0100.03712.71
5.3.220.0110.05012.68
5.3.210.0080.04412.68
5.3.200.0080.05212.68
5.3.190.0110.04812.68
5.3.180.0060.04112.67
5.3.170.0040.04012.67
5.3.160.0080.05312.68
5.3.150.0100.03712.68
5.3.140.0060.03912.66
5.3.130.0100.03712.65
5.3.120.0070.04112.66
5.3.110.0080.04612.66
5.3.100.0130.04512.13
5.3.90.0040.04912.11
5.3.80.0050.04912.10
5.3.70.0080.03712.10
5.3.60.0110.04612.09
5.3.50.0100.03612.04
5.3.40.0070.03912.04
5.3.30.0100.04212.00
5.3.20.0050.03911.78
5.3.10.0050.03811.74
5.3.00.0080.03911.73
5.2.170.0080.0309.23
5.2.160.0070.0309.23
5.2.150.0060.0349.23
5.2.140.0040.0379.23
5.2.130.0080.0329.19
5.2.120.0090.0289.18
5.2.110.0120.0529.20
5.2.100.0080.0399.19
5.2.90.0070.0319.19
5.2.80.0100.0289.18
5.2.70.0070.0309.18
5.2.60.0060.0319.14
5.2.50.0090.0349.11
5.2.40.0060.0319.08
5.2.30.0220.0649.06
5.2.20.0080.0369.05
5.2.10.0060.0298.96
5.2.00.0080.0398.83
5.1.60.0060.0268.12
5.1.50.0070.0318.12
5.1.40.0050.0348.09
5.1.30.0050.0278.44
5.1.20.0040.0288.47
5.1.10.0040.0288.19
5.1.00.0060.0268.19
5.0.50.0070.0186.63
5.0.40.0050.0226.49
5.0.30.0080.0326.30
5.0.20.0040.0226.27
5.0.10.0040.0206.25
5.0.00.0060.0296.24
4.4.90.0040.0154.78
4.4.80.0040.0164.75
4.4.70.0030.0164.75
4.4.60.0040.0154.75
4.4.50.0010.0174.77
4.4.40.0020.0264.71
4.4.30.0030.0174.76
4.4.20.0050.0174.85
4.4.10.0020.0164.85
4.4.00.0030.0254.76
4.3.110.0040.0174.66
4.3.100.0030.0164.66
4.3.90.0060.0124.63
4.3.80.0060.0414.59
4.3.70.0030.0164.63
4.3.60.0070.0134.63
4.3.50.0030.0174.63
4.3.40.0030.0244.54
4.3.30.0020.0163.29
4.3.20.0010.0183.27
4.3.10.0000.0183.23
4.3.00.0130.0236.81

preferences:
56.29 ms | 401 KiB | 5 Q