3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * This class is a hand written simplified version of PHP native `ArrayObject` * class, to show that it behaves differently than the PHP native implementation. */ class CustomArrayObject implements ArrayAccess, IteratorAggregate, Countable, Serializable { private $array; public function __construct(array $array = array()) { $this->array = $array; } public function offsetExists($offset) { echo 'called '; return array_key_exists($offset, $this->array); } public function offsetGet($offset) { return $this->array[$offset]; } public function offsetSet($offset, $value) { if (null === $offset) { $this->array[] = $value; } else { $this->array[$offset] = $value; } } public function offsetUnset($offset) { unset($this->array[$offset]); } public function getIterator() { echo 'iterator created '; return new ArrayIterator($this->array); } public function count() { return count($this->array); } public function serialize() { return serialize($this->array); } public function unserialize($serialized) { $this->array = (array) unserialize((string) $serialized); } } $array = array('foo' => 'bar', 'nulled' => null); $native = new ArrayObject($array); $custom = new CustomArrayObject($array); error_reporting(-1); $a = array_key_exists('missing', $custom); var_dump($a); var_dump(isset($custom['missing']) || array_key_exists('missing', $custom));

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.0150.00618.68
8.3.50.0140.00522.05
8.3.40.0100.01018.88
8.3.30.0070.00720.25
8.3.20.0040.00418.93
8.3.10.0080.00021.22
8.3.00.0030.00619.78
8.2.180.0170.00716.86
8.2.170.0100.01022.96
8.2.160.0140.00020.39
8.2.150.0000.00824.18
8.2.140.0000.00824.66
8.2.130.0070.00026.16
8.2.120.0100.00321.13
8.2.110.0040.00422.08
8.2.100.0080.00418.03
8.2.90.0040.00419.34
8.2.80.0000.00819.38
8.2.70.0050.00517.50
8.2.60.0060.00318.05
8.2.50.0040.00418.07
8.2.40.0000.00819.76
8.2.30.0040.00419.32
8.2.20.0070.00017.85
8.2.10.0020.00517.80
8.2.00.0040.00417.80
8.1.280.0070.01325.92
8.1.270.0060.00323.99
8.1.260.0070.00726.35
8.1.250.0080.00028.09
8.1.240.0030.00622.54
8.1.230.0040.00721.10
8.1.220.0050.00318.77
8.1.210.0030.00519.06
8.1.200.0090.00017.38
8.1.190.0080.00017.66
8.1.180.0060.00318.10
8.1.170.0040.00418.64
8.1.160.0030.00518.95
8.1.150.0060.00618.70
8.1.140.0040.00417.37
8.1.130.0030.00317.80
8.1.120.0070.00017.50
8.1.110.0040.00817.43
8.1.100.0070.00017.37
8.1.90.0070.00017.46
8.1.80.0030.00517.52
8.1.70.0000.00717.51
8.1.60.0030.00617.48
8.1.50.0040.00417.46
8.1.40.0000.00817.47
8.1.30.0040.00417.56
8.1.20.0080.00017.52
8.1.10.0000.00817.58
8.1.00.0000.00717.51
8.0.300.0040.00420.02
8.0.290.0000.00817.15
8.0.280.0030.00318.44
8.0.270.0070.00017.16
8.0.260.0060.00016.85
8.0.250.0000.00717.09
8.0.240.0060.00317.06
8.0.230.0000.00716.92
8.0.220.0000.00717.00
8.0.210.0030.00316.98
8.0.200.0040.00416.92
8.0.190.0030.00317.02
8.0.180.0040.00417.03
8.0.170.0040.00416.89
8.0.160.0040.00816.90
8.0.150.0030.00316.84
8.0.140.0040.00416.87
8.0.130.0050.00013.27
8.0.120.0090.00016.89
8.0.110.0050.00216.99
8.0.100.0080.00016.86
8.0.90.0000.00717.02
8.0.80.0100.00717.01
8.0.70.0020.00516.82
8.0.60.0000.00716.90
8.0.50.0070.00017.00
8.0.30.0120.01017.06
8.0.20.0100.00917.40
8.0.10.0000.00716.96
8.0.00.0090.00816.77
7.4.330.0050.00016.82
7.4.320.0060.00016.47
7.4.300.0060.00016.38
7.4.290.0030.00316.42
7.4.280.0070.00016.55
7.4.270.0050.00316.56
7.4.260.0000.00613.26
7.4.250.0050.00216.44
7.4.240.0020.00516.61
7.4.230.0030.00316.57
7.4.220.0070.01016.41
7.4.210.0060.01016.58
7.4.200.0000.00716.35
7.4.190.0000.00716.71
7.4.160.0040.01216.63
7.4.150.0120.00617.40
7.4.140.0120.01117.86
7.4.130.0130.00716.60
7.4.120.0090.01016.66
7.4.110.0090.01316.59
7.4.100.0110.00716.63
7.4.90.0140.00916.62
7.4.80.0110.01119.39
7.4.70.0060.02116.64
7.4.60.0140.00316.52
7.4.50.0000.00816.18
7.4.40.0000.01322.77
7.4.30.0080.00916.52
7.4.10.0130.00616.63
7.4.00.0140.00215.62
7.3.330.0050.00013.15
7.3.320.0030.00313.24
7.3.310.0030.00316.27
7.3.300.0030.00316.33
7.3.290.0030.01616.28
7.3.280.0070.00916.25
7.3.270.0130.00317.40
7.3.260.0120.00918.24
7.3.250.0090.00916.44
7.3.240.0060.01016.38
7.3.230.0030.01416.39
7.3.210.0040.01316.18
7.3.200.0070.01319.39
7.3.190.0150.00616.64
7.3.180.0120.00816.34
7.3.170.0150.00016.44
7.3.160.0080.00816.46
7.3.130.0040.01416.27
7.3.120.0070.00815.51
7.3.110.0000.01416.43
7.3.100.0030.01216.21
7.3.90.0050.00816.37
7.3.80.0070.00416.45
7.3.70.0030.01016.30
7.3.60.0090.00616.34
7.3.50.0040.01216.40
7.3.40.0070.00716.18
7.3.30.0070.00716.18
7.3.20.0070.00718.12
7.3.10.0070.00716.98
7.3.00.0100.00516.96
7.2.330.0070.01316.68
7.2.320.0090.00916.83
7.2.310.0110.00716.46
7.2.300.0090.01216.55
7.2.290.0000.01716.67
7.2.260.0060.01316.44
7.2.250.0060.01316.48
7.2.240.0090.00916.48
7.2.230.0000.01816.50
7.2.220.0080.00516.69
7.2.210.0040.01416.83
7.2.200.0100.00616.43
7.2.190.0040.00916.55
7.2.180.0070.01116.58
7.2.170.0060.00616.43
7.2.160.0000.01116.46
7.2.150.0030.01018.38
7.2.140.0100.00718.44
7.2.130.0080.00817.65
7.2.120.0100.00517.46
7.2.110.0070.00717.77
7.2.100.0090.00917.50
7.2.90.0000.01317.44
7.2.80.0110.00717.68
7.2.70.0090.00917.54
7.2.60.0120.00617.41
7.2.50.0140.00817.65
7.2.40.0130.00817.74
7.2.30.0110.00517.55
7.2.20.0130.00817.67
7.2.10.0090.00917.52
7.2.00.0060.01017.96
7.1.330.0030.01017.50
7.1.320.0040.00817.24
7.1.310.0090.00617.23
7.1.300.0100.00317.27
7.1.290.0060.00617.40
7.1.280.0070.00717.30
7.1.270.0080.00417.35
7.1.260.0040.00817.34
7.1.250.0050.01116.38
7.1.240.0000.01017.25
7.1.230.0030.01017.32
7.1.220.0000.01417.27
7.1.210.0030.01017.16
7.1.200.0020.01116.50
7.1.190.0000.01517.39
7.1.180.0030.00617.33
7.1.170.0090.00917.17
7.1.160.0000.01017.27
7.1.150.0030.01017.58
7.1.140.0030.00917.36
7.1.130.0030.01017.54
7.1.120.0000.01417.25
7.1.110.0070.00717.48
7.1.100.0030.01317.71
7.1.90.0030.01017.50
7.1.80.0080.00817.42
7.1.70.0030.00817.20
7.1.60.0050.01017.14
7.1.50.0000.01617.12
7.1.40.0130.00317.37
7.1.30.0060.01217.43
7.1.20.0090.00617.32
7.1.10.0040.01117.29
7.1.00.0030.02019.81
7.0.330.0050.00517.16
7.0.320.0060.00317.03
7.0.310.0030.00617.19
7.0.300.0000.01617.19
7.0.290.0090.00317.02
7.0.280.0070.00716.90
7.0.270.0030.01217.06
7.0.260.0000.01517.12
7.0.250.0060.01317.23
7.0.240.0070.00717.07
7.0.230.0070.01117.12
7.0.220.0040.01116.84
7.0.210.0070.01017.13
7.0.200.0050.00816.84
7.0.190.0060.00617.08
7.0.180.0060.00817.23
7.0.170.0120.00417.00
7.0.160.0040.00916.94
7.0.150.0100.00317.14
7.0.140.0100.03519.61
7.0.130.0060.01016.84
7.0.120.0040.00817.07
7.0.110.0040.00816.96
7.0.100.0100.03918.46
7.0.90.0030.03818.54
7.0.80.0100.02418.56
7.0.70.0080.04318.41
7.0.60.0090.04018.48
7.0.50.0050.02718.67
7.0.40.0100.02017.61
7.0.30.0090.02317.64
7.0.20.0070.02717.51
7.0.10.0030.02517.42
7.0.00.0020.02617.51
5.6.400.0070.01016.20
5.6.390.0030.00716.09
5.6.380.0030.00915.82
5.6.370.0070.00716.08
5.6.360.0110.00416.03
5.6.350.0030.01415.98
5.6.340.0000.01216.08
5.6.330.0060.00616.01
5.6.320.0130.00315.66
5.6.310.0070.01115.96
5.6.300.0040.01116.13
5.6.290.0030.01015.89
5.6.280.0110.03618.69
5.6.270.0050.00516.02
5.6.260.0000.01215.85
5.6.250.0020.05318.44
5.6.240.0020.04718.40
5.6.230.0050.04718.28
5.6.220.0070.03818.24
5.6.210.0050.04818.27
5.6.200.0070.02518.51
5.6.190.0050.02918.45
5.6.180.0100.03218.41
5.6.170.0100.01818.55
5.6.160.0070.02418.44
5.6.150.0090.02918.54
5.6.140.0100.02218.38
5.6.130.0050.02318.37
5.6.120.0080.03918.48
5.6.110.0130.03718.57
5.6.100.0030.02718.51
5.6.90.0070.03818.39
5.6.80.0070.02218.29
5.6.70.0050.04418.21
5.6.60.0030.03118.10
5.6.50.0020.02718.09
5.6.40.0040.02418.17
5.6.30.0080.02218.21
5.6.20.0050.02318.12
5.6.10.0030.02718.12
5.6.00.0050.02518.18
5.5.380.0050.04518.14
5.5.370.0080.04118.19
5.5.360.0100.03318.08
5.5.350.0030.04018.27
5.5.340.0080.02218.26
5.5.330.0060.02318.25
5.5.320.0070.02018.38
5.5.310.0050.02618.46
5.5.300.0030.02518.41
5.5.290.0060.04318.33
5.5.280.0050.02518.48
5.5.270.0090.04018.41
5.5.260.0080.02218.28
5.5.250.0050.02518.18
5.5.240.0000.02718.01
5.5.230.0050.04417.93
5.5.220.0070.02417.85
5.5.210.0050.02917.89
5.5.200.0070.02018.11
5.5.190.0050.02317.93
5.5.180.0040.02418.03
5.5.170.0030.00916.00
5.5.160.0030.03118.03
5.5.150.0050.02217.98
5.5.140.0020.02718.12
5.5.130.0090.01818.07
5.5.120.0030.02518.06
5.5.110.0060.02818.03
5.5.100.0040.02217.87
5.5.90.0020.02317.96
5.5.80.0040.02517.95
5.5.70.0100.01818.01
5.5.60.0090.01917.88
5.5.50.0070.02217.99
5.5.40.0030.02217.94
5.5.30.0080.02318.01
5.5.20.0130.03517.95
5.5.10.0050.03817.95
5.5.00.0080.03817.81
5.4.450.0130.02616.20
5.4.440.0030.02316.08
5.4.430.0020.03416.16
5.4.420.0040.02416.03
5.4.410.0100.02516.12
5.4.400.0020.02415.99
5.4.390.0030.02215.87
5.4.380.0020.02515.77
5.4.370.0090.01715.95
5.4.360.0030.02215.82
5.4.350.0030.02315.80
5.4.340.0050.03515.87
5.4.330.0030.01012.82
5.4.320.0070.01815.88
5.4.310.0050.02015.94
5.4.300.0070.02715.86
5.4.290.0030.02215.78
5.4.280.0090.01515.91
5.4.270.0030.02315.89
5.4.260.0040.02015.82
5.4.250.0040.02415.97
5.4.240.0060.02315.89
5.4.230.0040.02216.01
5.4.220.0070.02315.78
5.4.210.0030.02415.79
5.4.200.0050.02215.91
5.4.190.0050.02315.82
5.4.180.0050.03615.96
5.4.170.0070.04015.92
5.4.160.0060.03915.85
5.4.150.0030.04715.99
5.4.140.0050.04414.71
5.4.130.0070.03714.55
5.4.120.0140.03014.63
5.4.110.0070.04014.59
5.4.100.0070.03814.52
5.4.90.0050.03614.57
5.4.80.0040.03814.56
5.4.70.0050.03814.54
5.4.60.0070.03714.54
5.4.50.0070.03814.65
5.4.40.0050.04214.60
5.4.30.0090.03614.51
5.4.20.0000.03014.56
5.4.10.0080.03714.64
5.4.00.0020.02914.17
5.3.290.0030.02413.92
5.3.280.0040.02113.88
5.3.270.0030.04713.87
5.3.260.0090.04013.83
5.3.250.0070.04013.85
5.3.240.0100.03713.86
5.3.230.0070.04313.93
5.3.220.0000.04413.76
5.3.210.0050.03313.77
5.3.200.0030.04113.76
5.3.190.0070.03613.82
5.3.180.0040.04113.93
5.3.170.0100.02113.87
5.3.160.0050.02513.84
5.3.150.0070.03813.81
5.3.140.0030.04313.92
5.3.130.0100.03813.84
5.3.120.0030.04613.81
5.3.110.0050.04513.81
5.3.100.0100.04013.55
5.3.90.0070.04413.51
5.3.80.0050.02813.56
5.3.70.0070.03913.53
5.3.60.0030.04313.60
5.3.50.0070.04013.43
5.3.40.0110.03613.47
5.3.30.0070.02513.54
5.3.20.0100.02813.36
5.3.10.0040.02313.37
5.3.00.0030.03813.22
5.2.170.0070.06011.61
5.2.160.0030.05311.61
5.2.150.0030.06311.61
5.2.140.0100.05011.61
5.2.130.0030.05711.61
5.2.120.0000.05311.61
5.2.110.0030.06011.61
5.2.100.0000.06311.61
5.2.90.0000.05311.61
5.2.80.0130.05311.61
5.2.70.0070.05711.61
5.2.60.0070.05711.61
5.2.50.0070.06011.61
5.2.40.0070.05011.61
5.2.30.0030.06311.61
5.2.20.0000.06311.61
5.2.10.0100.05311.61
5.2.00.0030.04711.61
5.1.60.0100.04711.61
5.1.50.0100.05311.61
5.1.40.0030.05711.61
5.1.30.0000.06011.61
5.1.20.0000.03311.61
5.1.10.0000.04711.61
5.1.00.0070.05711.61
5.0.50.0030.04311.61
5.0.40.0030.04311.61
5.0.30.0000.06711.61
5.0.20.0000.03711.61
5.0.10.0030.03311.61
5.0.00.0030.04311.61
4.4.90.0030.03011.61
4.4.80.0070.03011.61
4.4.70.0130.02311.61
4.4.60.0000.03711.61
4.4.50.0070.02711.61
4.4.40.0000.04711.61
4.4.30.0030.03711.61
4.4.20.0000.03711.61
4.4.10.0030.03711.61
4.4.00.0000.03311.61
4.3.110.0030.03311.61
4.3.100.0000.03711.61
4.3.90.0030.03711.61
4.3.80.0000.05311.61
4.3.70.0000.03011.61
4.3.60.0000.03711.61
4.3.50.0000.03711.61
4.3.40.0070.04311.61
4.3.30.0000.04011.61
4.3.20.0000.02711.61
4.3.10.0000.03711.61
4.3.00.0000.03711.61

preferences:
47.08 ms | 401 KiB | 5 Q