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 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.0140.00416.63
8.3.50.0100.00817.57
8.3.40.0180.00418.96
8.3.30.0070.00718.79
8.3.20.0030.00618.93
8.3.10.0080.00020.66
8.3.00.0060.00319.51
8.2.180.0120.00425.92
8.2.170.0110.00418.96
8.2.160.0100.00322.96
8.2.150.0090.00325.66
8.2.140.0110.00424.66
8.2.130.0040.00426.16
8.2.120.0070.00319.91
8.2.110.0040.01320.73
8.2.100.0090.00717.70
8.2.90.0070.00518.62
8.2.80.0030.00617.86
8.2.70.0020.00717.69
8.2.60.0050.00617.65
8.2.50.0070.00317.85
8.2.40.0060.00317.82
8.2.30.0030.00517.95
8.2.20.0120.00518.53
8.2.10.0060.00417.66
8.2.00.0060.00717.77
8.1.270.0050.00223.99
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0080.00219.77
8.1.230.0100.00217.45
8.1.220.0080.00117.61
8.1.210.0080.00718.69
8.1.200.0060.00417.35
8.1.190.0060.00317.33
8.1.180.0100.00717.67
8.1.170.0050.00417.89
8.1.160.0070.00218.23
8.1.150.0060.00917.92
8.1.140.0070.00217.42
8.1.130.0050.00317.63
8.1.120.0000.00917.37
8.1.110.0040.00517.42
8.1.100.0030.00517.40
8.1.90.0030.00517.37
8.1.80.0060.00217.45
8.1.70.0010.00717.42
8.1.60.0020.00617.44
8.1.50.0050.01017.46
8.1.40.0070.00217.53
8.1.30.0040.00517.64
8.1.20.0120.00417.60
8.1.10.0050.00517.49
8.1.00.0040.00417.40
8.0.300.0060.00817.63
8.0.290.0030.00516.75
8.0.280.0050.00917.45
8.0.270.0030.00516.95
8.0.260.0040.00416.84
8.0.250.0070.00716.71
8.0.240.0030.00516.90
8.0.230.0060.00316.68
8.0.220.0080.00716.79
8.0.210.0070.00216.86
8.0.200.0110.00516.79
8.0.190.0080.00016.96
8.0.180.0030.00516.86
8.0.170.0030.00616.82
8.0.160.0050.00416.85
8.0.150.0080.00016.87
8.0.140.0040.00516.68
8.0.130.0020.00615.07
8.0.120.0100.00616.84
8.0.110.0040.00516.83
8.0.100.0090.00616.72
8.0.90.0090.00416.89
8.0.80.0120.00816.89
8.0.70.0090.00316.71
8.0.60.0110.00016.92
8.0.50.0020.00716.87
8.0.30.0100.00517.06
8.0.20.0080.00817.03
8.0.10.0040.00416.98
8.0.00.0100.00816.96
7.4.330.0030.00413.00
7.4.320.0090.00316.31
7.4.300.0020.00616.48
7.4.290.0170.00516.54
7.4.280.0170.00716.54
7.4.270.0180.00316.35
7.4.260.0100.00814.86
7.4.250.0190.00416.39
7.4.240.0180.00516.38
7.4.230.0130.00916.47
7.4.220.0160.00916.44
7.4.210.0210.00716.46
7.4.200.0140.01016.38
7.4.190.0210.00516.51
7.4.180.0300.00416.50
7.4.160.0180.00917.21
7.4.150.0130.00716.31
7.4.140.0170.00516.53
7.4.130.0120.00716.33
7.4.120.0080.01116.30
7.4.110.0080.01216.36
7.4.100.0140.00616.22
7.4.90.0130.00916.28
7.4.80.0140.00416.30
7.4.70.0100.00716.34
7.4.60.0140.00416.43
7.4.50.0070.00516.13
7.4.40.0130.00316.40
7.4.30.0110.00616.30
7.4.20.0160.00316.37
7.4.10.0140.00416.13
7.4.00.0030.00915.80
7.3.330.0020.00614.67
7.3.320.0090.00414.67
7.3.310.0090.00416.24
7.3.300.0110.00316.30
7.3.290.0080.00916.27
7.3.280.0070.01216.23
7.3.270.0160.00316.13
7.3.260.0120.00916.22
7.3.250.0110.00816.42
7.3.240.0140.00316.25
7.3.230.0130.00416.29
7.3.220.0140.00516.00
7.3.210.0140.00516.26
7.3.200.0130.00817.70
7.3.190.0130.00716.28
7.3.180.0100.00716.06
7.3.170.0130.00516.20
7.3.160.0120.00717.13
7.3.150.0120.00916.00
7.3.140.0140.00716.00
7.3.130.0180.00315.84
7.3.120.0140.00515.46
7.3.110.0130.00715.73
7.3.100.0170.00315.75
7.3.90.0170.00316.13
7.3.80.0200.00015.98
7.3.70.0100.01015.98
7.3.60.0160.00416.25
7.3.50.0150.00417.67
7.3.40.0200.00016.00
7.3.30.0200.00017.93
7.3.20.0190.00017.83
7.3.10.0190.00417.84
7.3.00.0090.00318.02
7.2.340.0090.00317.98
7.2.330.0140.00516.50
7.2.320.0140.00416.40
7.2.310.0140.00616.42
7.2.300.0130.00616.22
7.2.290.0150.00516.44
7.2.280.0110.00816.38
7.2.270.0140.00516.13
7.2.260.0100.01016.25
7.2.250.0120.00816.25
7.2.240.0180.00216.13
7.2.230.0100.01016.00
7.2.220.0140.00516.13
7.2.210.0190.00016.25
7.2.200.0130.00516.25
7.2.190.0150.00316.00
7.2.180.0140.00516.38
7.2.170.0190.00016.13
7.2.160.0170.00316.38
7.2.150.0180.00418.11
7.2.140.0140.00718.13
7.2.130.0150.00718.52
7.2.120.0150.00517.91
7.2.110.0110.00718.28
7.2.100.0170.00318.08
7.2.90.0180.00318.14
7.2.80.0190.00018.00
7.2.70.0170.00318.07
7.2.60.0070.00717.29
7.2.50.0130.00818.10
7.2.40.0090.00918.11
7.2.30.0200.00018.38
7.2.20.0140.00618.21
7.2.10.0190.00018.38
7.2.00.0070.00518.99
7.1.330.0000.00917.24
7.1.320.0200.00317.00
7.1.310.0160.00316.99
7.1.300.0110.00617.14
7.1.290.0110.00617.19
7.1.280.0120.00617.05
7.1.270.0120.00516.96
7.1.260.0140.00416.98
7.1.250.0130.00416.99
7.1.240.0120.00616.96
7.1.230.0140.00517.09
7.1.220.0130.01016.89
7.1.210.0220.00717.14
7.1.200.0140.00016.45
7.1.190.0180.00016.81
7.1.180.0180.00017.11
7.1.170.0160.00317.19
7.1.160.0100.00716.98
7.1.150.0150.00316.94
7.1.140.0150.00216.69
7.1.130.0110.00617.01
7.1.120.0140.00316.98
7.1.110.0110.00517.07
7.1.100.0070.00717.56
7.1.90.0140.00517.09
7.1.80.0090.00917.24
7.1.70.0060.00817.22
7.1.60.0160.00518.05
7.1.50.0150.00525.63
7.1.40.0160.00316.99
7.1.30.0160.00317.09
7.1.20.0190.00017.24
7.1.10.0170.00316.99
7.1.00.0110.03319.72
7.0.330.0130.00516.98
7.0.320.0090.00916.73
7.0.310.0110.00717.10
7.0.300.0140.00416.98
7.0.290.0120.00616.52
7.0.280.0100.00816.61
7.0.270.0130.00716.85
7.0.260.0100.01016.64
7.0.250.0130.00517.07
7.0.240.0140.00516.95
7.0.230.0130.00716.87
7.0.220.0140.00316.99
7.0.210.0120.00616.87
7.0.200.0230.00316.00
7.0.190.0140.00616.74
7.0.180.0160.00216.73
7.0.170.0110.00716.91
7.0.160.0170.00016.87
7.0.150.0130.00416.82
7.0.140.0110.03619.37
7.0.130.0140.00516.85
7.0.120.0060.04119.49
7.0.110.0170.00316.75
7.0.100.0110.00516.71
7.0.90.0160.00216.50
7.0.80.0140.00316.77
7.0.70.0160.00016.88
7.0.60.0110.03418.52
7.0.50.0080.02517.42
7.0.40.0130.02518.41
7.0.30.0210.02618.56
7.0.20.0200.03018.45
7.0.10.0120.04318.55
7.0.00.0110.04018.48
5.6.400.0170.00215.75
5.6.390.0120.00815.75
5.6.380.0170.00315.88
5.6.370.0100.00715.88
5.6.360.0100.00716.00
5.6.350.0100.01015.88
5.6.340.0180.00015.75
5.6.330.0160.00416.00
5.6.320.0150.00315.88
5.6.310.0210.00015.75
5.6.300.0130.00515.63
5.6.290.0160.00415.88
5.6.280.0120.03518.41
5.6.270.0180.00015.75
5.6.260.0130.00315.88
5.6.250.0160.00015.88
5.6.240.0120.00415.88
5.6.230.0200.00015.88
5.6.220.0190.00016.00
5.6.210.0140.02218.32
5.6.200.0090.04017.14
5.6.190.0040.03418.32
5.6.180.0130.02518.30
5.6.170.0240.01918.27
5.6.160.0160.02218.22
5.6.150.0120.02517.03
5.6.140.0100.03517.03
5.6.130.0110.04216.94
5.6.120.0120.02318.43
5.6.110.0090.02318.44
5.6.100.0150.03618.34
5.6.90.0100.03418.54
5.6.80.0140.03518.15
5.6.70.0130.00415.75
5.6.60.0160.00416.00
5.6.50.0170.00016.00
5.6.40.0130.00316.00
5.6.30.0160.00015.88
5.6.20.0120.00715.88
5.6.10.0120.00415.75
5.6.00.0200.00415.75
5.5.380.0230.00615.75
5.5.370.0160.00515.88
5.5.360.0160.00315.63
5.5.350.0170.03818.10
5.5.340.0140.02016.85
5.5.330.0130.04718.06
5.5.320.0460.03217.95
5.5.310.0210.02618.01
5.5.300.0210.03017.00
5.5.290.0150.04317.02
5.5.280.0160.03818.37
5.5.270.0120.02518.35
5.5.260.0110.04218.28
5.5.250.0110.04618.41
5.5.240.0080.04018.10
5.5.230.0140.00516.00
5.5.220.0150.00015.75
5.5.210.0080.00815.88
5.5.200.0140.00515.75
5.5.190.0110.00715.63
5.5.180.0080.00815.88
5.5.170.0130.00615.75
5.5.160.0120.00515.88
5.5.150.0150.00415.63
5.5.140.0130.00415.63
5.5.130.0140.00515.63
5.5.120.0110.00715.63
5.5.110.0150.00315.75
5.5.100.0180.00016.00
5.5.90.0110.00515.75
5.5.80.0160.00316.00
5.5.70.0130.00315.88
5.5.60.0150.00415.88
5.5.50.0110.00716.00
5.5.40.0160.00315.88
5.5.30.0140.00215.88
5.5.20.0170.00015.88
5.5.10.0160.00315.63
5.5.00.0160.00015.75
5.4.450.0980.02316.06
5.4.440.1080.02316.23
5.4.430.1100.02616.28
5.4.420.1120.02216.19
5.4.410.1080.02216.20
5.4.400.1050.01715.94
5.4.390.1080.02016.04
5.4.380.1100.02215.90
5.4.370.0970.02015.94
5.4.360.1060.02516.07
5.4.350.1000.02315.90
5.4.340.1180.02216.06
5.4.330.0080.00512.92
5.4.320.1140.02416.04
5.4.310.1100.02216.01
5.4.300.1080.02216.00
5.4.290.1180.01516.02
5.4.280.1060.02315.98
5.4.270.1100.02015.94
5.4.260.1030.02316.00
5.4.250.1050.02016.08
5.4.240.0930.02016.00
5.4.230.0960.01716.04
5.4.220.1100.02015.96
5.4.210.1160.02016.00
5.4.200.1030.02815.95
5.4.190.1040.02215.99
5.4.180.0960.01715.99
5.4.170.1050.03015.93
5.4.160.1080.02516.06
5.4.150.0880.02016.02
5.4.140.1120.02314.75
5.4.130.1030.02314.83
5.4.120.1080.01814.81
5.4.110.1000.01814.71
5.4.100.1110.01514.77
5.4.90.1030.01714.58
5.4.80.0950.01614.72
5.4.70.0980.02014.74
5.4.60.0980.02114.68
5.4.50.1010.01714.69
5.4.40.1020.01514.56
5.4.30.0980.02014.75
5.4.20.0930.01614.73
5.4.10.1020.01514.59
5.4.00.1230.01714.38
5.3.290.1020.01713.92
5.3.280.1640.02313.84
5.3.270.1450.02213.74
5.3.260.0780.02213.78
5.3.250.0980.01713.74
5.3.240.0920.01913.74
5.3.230.0950.02213.78
5.3.220.0970.02013.76
5.3.210.0990.02213.80
5.3.200.1050.01813.77
5.3.190.1030.02213.88
5.3.180.0950.02313.93
5.3.170.1000.01313.84
5.3.160.1120.02213.80
5.3.150.0950.02013.82
5.3.140.1150.02313.77
5.3.130.0930.02313.75
5.3.120.1000.01713.71
5.3.110.1100.02213.71
5.3.100.1000.02413.49
5.3.90.1000.03113.61
5.3.80.1110.01813.54
5.3.70.1070.02013.53
5.3.60.0990.02013.49
5.3.50.1100.02213.42
5.3.40.1060.02313.52
5.3.30.1080.02413.51
5.3.20.1030.02413.29
5.3.10.1140.02313.30
5.3.00.1130.02113.26
5.2.170.0930.02012.02
5.2.160.0860.02012.12
5.2.150.0800.01712.09
5.2.140.0920.02012.05
5.2.130.0910.02012.05
5.2.120.0950.01312.12
5.2.110.0920.01211.99
5.2.100.0880.01812.10
5.2.90.0930.02112.00
5.2.80.0830.01312.02
5.2.70.0830.01612.02
5.2.60.0790.02012.13
5.2.50.0950.01512.02
5.2.40.0820.01811.94
5.2.30.0770.01711.93
5.2.20.0610.01811.94
5.2.10.0720.01711.89
5.2.00.0610.01811.89
5.1.60.0680.01711.60
5.1.50.0750.01811.47
5.1.40.0610.01611.44
5.1.30.0750.01711.61
5.1.20.0750.01311.72
5.1.10.0800.01511.60
5.1.00.0670.01311.52
5.0.50.0360.01011.18
5.0.40.0420.01611.18
5.0.30.0380.02211.18
5.0.20.0330.01011.18
5.0.10.0330.01011.18
5.0.00.0410.02211.18
4.4.90.0310.00711.18
4.4.80.0350.01311.18
4.4.70.0300.00811.18
4.4.60.0430.01011.18
4.4.50.0300.00811.18
4.4.40.0300.01311.18
4.4.30.0300.00811.18
4.4.20.0330.01211.18
4.4.10.0290.01011.18
4.4.00.0350.01011.18
4.3.110.0330.00711.18
4.3.100.0300.00911.18
4.3.90.0330.00511.18
4.3.80.0300.01311.18
4.3.70.0280.01011.18
4.3.60.0300.00811.18
4.3.50.0350.00711.18
4.3.40.0280.01511.18
4.3.30.0180.00711.18
4.3.20.0150.01111.18
4.3.10.0150.00811.18
4.3.00.0160.01011.18

preferences:
54.08 ms | 400 KiB | 5 Q