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 = null) { $this->array = $array ?: array(); } public function offsetExists($offset) { 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() { 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); foreach (array('array' => $array, 'native' => $native, 'custom' => $custom) as $type => $collection) { echo 'Using the ' . $type .' implementation'.PHP_EOL; var_dump(isset($collection['missing']) || array_key_exists('missing', $collection)); } $a = array_key_exists('missing', $custom); 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.43
8.3.50.0140.00721.98
8.3.40.0130.00619.06
8.3.30.0130.00320.23
8.3.20.0000.00818.81
8.3.10.0050.00321.02
8.3.00.0080.00019.80
8.2.180.0110.00816.88
8.2.170.0140.00722.96
8.2.160.0090.00620.39
8.2.150.0040.00424.18
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00421.18
8.2.110.0100.00019.25
8.2.100.0130.00017.91
8.2.90.0040.00419.19
8.2.80.0000.00817.97
8.2.70.0040.00417.63
8.2.60.0000.00818.05
8.2.50.0000.00818.10
8.2.40.0040.00818.28
8.2.30.0040.00419.46
8.2.20.0030.00517.71
8.2.10.0000.00817.91
8.2.00.0030.00617.86
8.1.280.0070.00725.92
8.1.270.0070.00723.99
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0000.00924.02
8.1.230.0040.00717.70
8.1.220.0030.00617.74
8.1.210.0040.00418.77
8.1.200.0060.00317.38
8.1.190.0000.00817.23
8.1.180.0000.00818.10
8.1.170.0030.00618.55
8.1.160.0030.00518.93
8.1.150.0100.00218.68
8.1.140.0000.00717.37
8.1.130.0000.00717.85
8.1.120.0000.00817.43
8.1.110.0060.00517.39
8.1.100.0030.00517.48
8.1.90.0000.00717.50
8.1.80.0080.00017.55
8.1.70.0030.00317.47
8.1.60.0000.00817.55
8.1.50.0000.00817.37
8.1.40.0070.00017.54
8.1.30.0000.00817.64
8.1.20.0060.00317.65
8.1.10.0040.00417.64
8.1.00.0030.00617.38
8.0.300.0000.00718.77
8.0.290.0030.00716.75
8.0.280.0040.00418.39
8.0.270.0040.00417.20
8.0.260.0030.00316.97
8.0.250.0060.00316.95
8.0.240.0040.00416.91
8.0.230.0000.00716.95
8.0.220.0030.00316.89
8.0.210.0040.00417.04
8.0.200.0040.00417.00
8.0.190.0000.00716.96
8.0.180.0040.00417.00
8.0.170.0040.00416.96
8.0.160.0050.00517.00
8.0.150.0040.00416.98
8.0.140.0080.00016.87
8.0.130.0030.00313.39
8.0.120.0000.00817.01
8.0.110.0080.00016.99
8.0.100.0030.00516.89
8.0.90.0080.00016.89
8.0.80.0060.01016.91
8.0.70.0040.00416.89
8.0.60.0000.00817.05
8.0.50.0040.00416.95
8.0.30.0100.01017.09
8.0.20.0140.00517.40
8.0.10.0030.00517.13
8.0.00.0110.00616.92
7.4.330.0050.00016.66
7.4.320.0030.00616.56
7.4.300.0000.00616.55
7.4.290.0030.00316.49
7.4.280.0030.00316.43
7.4.270.0050.00316.54
7.4.260.0000.00513.31
7.4.250.0070.00016.58
7.4.240.0030.00316.70
7.4.230.0000.00716.38
7.4.220.0170.00016.56
7.4.210.0090.00716.52
7.4.200.0040.00416.73
7.4.190.0070.00016.54
7.4.160.0050.01516.57
7.4.150.0060.01217.40
7.4.140.0100.00817.86
7.4.130.0070.01016.73
7.4.120.0040.01316.57
7.4.110.0120.00616.55
7.4.100.0130.01016.63
7.4.90.0110.00716.69
7.4.80.0150.00619.39
7.4.70.0030.02016.79
7.4.60.0090.00916.39
7.4.50.0030.00616.66
7.4.40.0060.00622.77
7.4.30.0050.01116.36
7.4.00.0070.01115.10
7.3.330.0020.00213.40
7.3.320.0000.00613.36
7.3.310.0070.00016.23
7.3.300.0000.00716.38
7.3.290.0000.01316.37
7.3.280.0060.01016.40
7.3.270.0090.00917.40
7.3.260.0110.00818.24
7.3.250.0140.00516.50
7.3.240.0070.01016.45
7.3.230.0130.00716.58
7.3.210.0130.00916.45
7.3.200.0150.00919.39
7.3.190.0140.00416.25
7.3.180.0060.01516.40
7.3.170.0090.00616.40
7.3.160.0100.00716.55
7.3.120.0030.01214.59
7.3.110.0030.01014.79
7.3.100.0060.01014.73
7.3.90.0040.01114.88
7.3.80.0040.01014.90
7.3.70.0090.00614.54
7.3.60.0100.00014.89
7.3.50.0030.01214.94
7.3.40.0070.01114.79
7.3.30.0120.00314.86
7.3.20.0070.00716.81
7.3.10.0070.00716.55
7.3.00.0090.00916.83
7.2.330.0110.00816.71
7.2.320.0030.01516.53
7.2.310.0090.01316.73
7.2.300.0100.01416.54
7.2.290.0090.00616.71
7.2.250.0040.01515.28
7.2.240.0140.00715.36
7.2.230.0040.01415.05
7.2.220.0060.00614.93
7.2.210.0030.01314.85
7.2.200.0090.00615.13
7.2.190.0070.01015.06
7.2.180.0000.01914.84
7.2.170.0130.00315.19
7.2.160.0040.00815.15
7.2.150.0080.00316.89
7.2.140.0060.01217.11
7.2.130.0030.01217.05
7.2.120.0040.01116.76
7.2.110.0100.00716.87
7.2.100.0120.00316.72
7.2.90.0080.00317.04
7.2.80.0090.00017.08
7.2.70.0060.00816.99
7.2.60.0060.00917.14
7.2.50.0100.00316.76
7.2.40.0060.00917.02
7.2.30.0000.01117.17
7.2.20.0030.00717.06
7.2.10.0070.00717.07
7.2.00.0070.01017.66
7.1.330.0070.01015.47
7.1.320.0100.00715.76
7.1.310.0040.00715.47
7.1.300.0060.00615.67
7.1.290.0030.01115.77
7.1.280.0090.00315.78
7.1.270.0060.00615.57
7.1.260.0110.00415.76
7.1.250.0040.00715.55
7.1.100.0040.01218.19
7.1.70.0000.00917.09
7.1.60.0060.00617.20
7.1.50.0030.00916.98
7.1.00.0070.03022.40
7.0.200.0060.01016.78
7.0.140.0030.07322.04
7.0.100.0030.04020.04
7.0.90.0030.04319.90
7.0.80.0130.03320.04
7.0.70.0030.04020.00
7.0.60.0030.04720.07
7.0.50.0170.03020.44
7.0.40.0100.08320.00
7.0.30.0030.08720.09
7.0.20.0030.08720.14
7.0.10.0130.08020.13
7.0.00.0030.08720.04
5.6.280.0100.06720.93
5.6.250.0030.04320.63
5.6.240.0030.04320.64
5.6.230.0070.03720.67
5.6.220.0030.04020.68
5.6.210.0030.03320.75
5.6.200.0000.04721.05
5.6.190.0070.08320.99
5.6.180.0000.08721.09
5.6.170.0130.06021.04
5.6.160.0130.07321.13
5.6.150.0070.04320.97
5.6.140.0130.08020.96
5.6.130.0070.08721.07
5.6.120.0100.04721.07
5.6.110.0130.04321.11
5.6.100.0100.08021.02
5.6.90.0170.07321.00
5.6.80.0100.06320.39
5.6.70.0200.04020.56
5.6.60.0070.06320.48
5.6.50.0030.05720.41
5.6.40.0130.04720.32
5.6.30.0130.07320.41
5.6.20.0070.07020.37
5.6.10.0070.07020.41
5.6.00.0100.07720.39
5.5.380.0000.04320.46
5.5.370.0100.03320.39
5.5.360.0070.04320.45
5.5.350.0100.04320.45
5.5.340.0070.04020.93
5.5.330.0070.08320.81
5.5.320.0130.07320.84
5.5.310.0030.09020.85
5.5.300.0130.07320.80
5.5.290.0070.07020.81
5.5.280.0170.07020.93
5.5.270.0100.08320.89
5.5.260.0100.08020.81
5.5.250.0130.06320.75
5.5.240.0130.03720.32
5.5.230.0100.08020.15
5.5.220.0070.07320.31
5.5.210.0170.06720.30
5.5.200.0100.08020.09
5.5.190.0000.07020.27
5.5.180.0200.06320.14
5.5.160.0170.07320.24
5.5.150.0070.05020.26
5.5.140.0070.07320.27
5.5.130.0070.07020.28
5.5.120.0200.06720.21
5.5.110.0070.04320.23
5.5.100.0170.06719.96
5.5.90.0100.07720.08
5.5.80.0100.05720.08
5.5.70.0200.06320.05
5.5.60.0130.05320.02
5.5.50.0070.08720.07
5.5.40.0070.04020.09
5.5.30.0030.07020.14
5.5.20.0070.05720.06
5.5.10.0130.06720.12
5.5.00.0170.03320.06
5.4.450.0000.04719.18
5.4.440.0130.07019.54
5.4.430.0100.04319.44
5.4.420.0030.06019.50
5.4.410.0030.08019.38
5.4.400.0100.06718.90
5.4.390.0170.06719.04
5.4.380.0130.07319.13
5.4.370.0000.04319.13
5.4.360.0130.06018.91
5.4.350.0070.08019.03
5.4.340.0030.05018.85
5.4.320.0100.04019.12
5.4.310.0100.07019.04
5.4.300.0100.05718.95
5.4.290.0070.08319.02
5.4.280.0030.08019.22
5.4.270.0130.06319.20
5.4.260.0130.07319.03
5.4.250.0170.06719.02
5.4.240.0100.07318.94
5.4.230.0100.07719.03
5.4.220.0070.04319.21
5.4.210.0130.05319.02
5.4.200.0070.07019.22
5.4.190.0100.03319.02
5.4.180.0230.07319.22
5.4.170.0100.03318.83
5.4.160.0170.06318.82
5.4.150.0000.05019.02
5.4.140.0000.07716.20
5.4.130.0170.06016.41
5.4.120.0070.07316.42
5.4.110.0100.04016.51
5.4.100.0130.05716.45
5.4.90.0070.04016.39
5.4.80.0030.03316.35
5.4.70.0070.07316.45
5.4.60.0030.07316.47
5.4.50.0100.06316.44
5.4.40.0170.05316.38
5.4.30.0170.06716.44
5.4.20.0130.07016.29
5.4.10.0030.09716.33
5.4.00.0030.05315.90
5.3.290.0030.08714.62
5.3.280.0070.07714.58
5.3.270.0070.07014.69
5.3.260.0030.08314.74
5.3.250.0100.03014.58
5.3.240.0100.02714.69
5.3.230.0100.05314.64
5.3.220.0130.07014.63
5.3.210.0100.05314.63
5.3.200.0030.08014.51
5.3.190.0000.07714.55
5.3.180.0070.07314.60
5.3.170.0030.04014.69
5.3.160.0130.06014.64
5.3.150.0170.06314.64
5.3.140.0100.05714.71
5.3.130.0030.08014.63
5.3.120.0000.08314.66
5.3.110.0000.06714.69
5.3.100.0100.03314.19
5.3.90.0100.06714.02
5.3.80.0130.07013.93
5.3.70.0070.06313.92
5.3.60.0000.08313.93
5.3.50.0100.06013.96
5.3.40.0030.08013.89
5.3.30.0030.04314.03
5.3.20.0170.06013.71
5.3.10.0070.04013.73
5.3.00.0100.03713.77
5.2.170.0130.04711.64
5.2.160.0000.06711.64
5.2.150.0030.03711.64
5.2.140.0100.06011.64
5.2.130.0030.04011.64
5.2.120.0070.05311.64
5.2.110.0100.05711.64
5.2.100.0070.04711.64
5.2.90.0000.05711.64
5.2.80.0070.04711.64
5.2.70.0030.04311.64
5.2.60.0070.04711.64
5.2.50.0070.06011.64
5.2.40.0100.05711.64
5.2.30.0100.05311.64
5.2.20.0030.03311.64
5.2.10.0070.05311.64
5.2.00.0100.05311.64
5.1.60.0030.03011.64
5.1.50.0070.05011.64
5.1.40.0130.03711.64
5.1.30.0030.03011.64
5.1.20.0070.05311.64
5.1.10.0070.04711.64
5.1.00.0070.05711.64
5.0.50.0070.03011.64
5.0.40.0070.04711.64
5.0.30.0070.03311.64
5.0.20.0000.03311.64
5.0.10.0000.04711.64
5.0.00.0100.05711.64
4.4.90.0000.03711.64
4.4.80.0030.02011.64
4.4.70.0030.01711.64
4.4.60.0030.03711.64
4.4.50.0030.01711.64
4.4.40.0070.04711.64
4.4.30.0000.03711.64
4.4.20.0070.03311.64
4.4.10.0030.02311.64
4.4.00.0100.04711.64
4.3.110.0030.03311.64
4.3.100.0000.03311.64
4.3.90.0000.03011.64
4.3.80.0000.03011.64
4.3.70.0030.01711.64
4.3.60.0000.03311.64
4.3.50.0070.03311.64
4.3.40.0070.04711.64
4.3.30.0000.03011.64
4.3.20.0000.02011.64
4.3.10.0070.03311.64
4.3.00.0000.02011.64

preferences:
48.83 ms | 401 KiB | 5 Q