3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test extends ArrayIterator { public function __toString() { /*if (count($this) > 1) { return (string) $this[0]; }*/ return (string) $this[0]; } } class XmlArrayAccessIterator implements ArrayAccess, IteratorAggregate { private $xml; public function __construct($filePath, $isUrl = true) { $this->isUrl = $isUrl; $this->xml = new SimpleXmlIterator($filePath, 0, $isUrl); } public function offsetExists($offset) { return !is_null($this->xml->$offset); } public function offsetGet($offset) { if ($this->xml->getName() == $offset) { return $this; } return new Test((array)$this->xml->$offset); } public function __toString() { return (string) $this->xml; } public function offsetSet($offset, $value) { throw new RuntimeException('This is readonly. writing to "' . (string) $offset . '" with value "' . (string) $value . '" not possible'); } public function offsetUnset($offset) { throw new RuntimeException('This is readonly. Unsetting "' . (string) $offset . '" not possible'); } public function getIterator() { return $this->xml; } } $str = '<?xml version="1.0"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don\'t forget me this weekend!</body> <recursive> <val>2</val> <val>4</val> </recursive> </note>'; $xml = new XmlArrayAccessIterator($str, false); echo $xml['note']['to']; echo $xml['note']['recursive']['val'][0];

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.0110.00418.66
8.3.50.0100.01017.39
8.3.40.0090.00919.04
8.3.30.0150.00319.08
8.3.20.0080.00018.87
8.3.10.0050.00320.82
8.3.00.0040.00417.63
8.2.180.0160.00616.88
8.2.170.0120.00322.96
8.2.160.0070.00722.43
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00420.07
8.2.110.0110.00022.32
8.2.100.0110.00018.09
8.2.90.0030.00618.16
8.2.80.0030.00617.97
8.2.70.0060.00317.88
8.2.60.0000.00818.29
8.2.50.0000.00818.07
8.2.40.0030.00618.39
8.2.30.0050.00318.41
8.2.20.0040.00418.13
8.2.10.0030.00617.95
8.2.00.0030.00617.98
8.1.280.0070.01425.92
8.1.270.0040.00423.99
8.1.260.0160.00326.35
8.1.250.0050.00228.09
8.1.240.0040.00422.18
8.1.230.0070.00421.04
8.1.220.0080.00017.89
8.1.210.0040.00418.99
8.1.200.0060.00317.60
8.1.190.0030.00517.65
8.1.180.0040.00818.10
8.1.170.0000.00819.16
8.1.160.0000.00819.09
8.1.150.0040.00418.85
8.1.140.0000.00817.57
8.1.130.0000.00717.93
8.1.120.0070.00017.73
8.1.110.0050.00317.64
8.1.100.0040.00417.72
8.1.90.0040.00417.69
8.1.80.0040.00417.70
8.1.70.0030.00317.60
8.1.60.0040.00417.70
8.1.50.0060.00317.58
8.1.40.0030.00517.62
8.1.30.0040.00417.69
8.1.20.0030.00617.75
8.1.10.0040.00417.71
8.1.00.0080.00017.71
8.0.300.0000.00720.23
8.0.290.0080.00016.88
8.0.280.0040.00418.62
8.0.270.0050.00217.50
8.0.260.0030.00317.05
8.0.250.0040.00417.06
8.0.240.0000.00717.03
8.0.230.0080.00017.13
8.0.220.0030.00317.05
8.0.210.0000.00817.10
8.0.200.0000.00617.04
8.0.190.0040.00417.13
8.0.180.0050.00217.09
8.0.170.0000.00817.11
8.0.160.0000.00717.11
8.0.150.0030.00617.01
8.0.140.0000.00916.98
8.0.130.0070.00013.62
8.0.120.0040.00417.08
8.0.110.0000.00816.91
8.0.100.0040.00416.97
8.0.90.0000.00817.02
8.0.80.0060.00917.17
8.0.70.0000.00717.14
8.0.60.0030.00517.15
8.0.50.0000.00717.02
8.0.30.0110.00717.52
8.0.20.0100.00817.25
8.0.10.0080.00017.21
8.0.00.0090.01117.05
7.4.330.0050.00014.86
7.4.320.0000.00616.81
7.4.300.0000.00816.74
7.4.290.0000.00716.74
7.4.280.0030.00616.68
7.4.270.0040.00416.82
7.4.260.0000.00613.52
7.4.250.0030.00516.73
7.4.240.0030.00616.64
7.4.230.0000.00816.85
7.4.220.0090.01216.84
7.4.210.0060.00916.86
7.4.200.0070.00016.82
7.4.190.0050.00216.74
7.4.160.0090.00616.70
7.4.150.0150.00317.07
7.4.140.0160.00617.28
7.4.130.0100.00716.76
7.4.120.0070.01016.57
7.4.110.0060.01716.65
7.4.100.0130.00416.73
7.4.90.0150.00416.84
7.4.80.0070.01018.80
7.4.70.0030.01516.56
7.4.60.0090.00916.60
7.4.50.0050.00316.63
7.4.40.0080.00422.27
7.4.30.0120.00416.79
7.4.00.0060.00914.85
7.3.330.0000.00613.47
7.3.320.0000.00513.52
7.3.310.0040.00416.40
7.3.300.0030.00316.55
7.3.290.0000.01416.53
7.3.280.0100.00616.61
7.3.270.0070.01017.07
7.3.260.0090.00818.24
7.3.250.0130.00716.57
7.3.240.0180.00416.80
7.3.230.0130.00316.50
7.3.210.0100.00716.43
7.3.200.0150.00619.39
7.3.190.0070.01016.64
7.3.180.0040.01216.62
7.3.170.0070.00716.87
7.3.160.0120.00316.75
7.3.120.0060.00915.16
7.2.330.0130.00316.99
7.2.320.0090.01017.00
7.2.310.0060.01816.92
7.2.300.0090.00916.76
7.2.290.0050.01416.72
7.2.00.0030.01019.81
7.1.100.0030.00718.46
7.1.70.0000.01317.34
7.1.60.0100.01419.40
7.1.50.0100.01616.92
7.1.00.0100.07022.54
7.0.200.0030.00516.94
7.0.140.0070.06722.12
7.0.60.0000.07020.11
7.0.50.0000.08017.88
7.0.40.0100.06317.89
7.0.30.0100.05017.88
7.0.20.0170.04017.92
7.0.10.0030.07017.92
7.0.00.0070.08317.88
5.6.280.0100.06721.21
5.6.210.0070.03720.57
5.6.200.0030.05018.29
5.6.190.0100.07718.23
5.6.180.0070.08318.34
5.6.170.0200.07018.32
5.6.160.0030.04718.36
5.6.150.0130.07018.41
5.6.140.0100.08018.38
5.6.130.0070.05018.37
5.6.120.0100.07318.32
5.6.110.0070.08318.34
5.6.100.0170.05718.23
5.6.90.0030.05318.23
5.6.80.0100.07317.76
5.6.70.0130.06717.68
5.6.60.0130.07017.60
5.6.50.0100.04717.61
5.6.40.0030.07717.68
5.6.30.0100.04317.66
5.6.20.0030.07717.67
5.6.10.0000.07717.71
5.6.00.0000.06717.70
5.5.350.0100.08020.47
5.5.340.0100.07718.11
5.5.330.0100.07718.12
5.5.320.0070.04018.10
5.5.310.0100.05018.09
5.5.300.0030.05018.02
5.5.290.0070.05018.04
5.5.280.0070.07718.15
5.5.270.0100.07018.02
5.5.260.0070.07718.09
5.5.250.0130.06717.92
5.5.240.0070.06317.57
5.5.230.0070.08017.50
5.5.220.0030.07317.48
5.5.210.0030.06717.45
5.5.200.0070.04317.52
5.5.190.0030.04017.51
5.5.180.0100.03717.46
5.5.160.0000.04717.57
5.5.150.0000.05017.53
5.5.140.0030.07317.47
5.5.130.0030.07317.40
5.5.120.0070.07017.43
5.5.110.0170.06317.45
5.5.100.0100.07017.31
5.5.90.0030.03717.37
5.5.80.0130.03317.24
5.5.70.0100.03717.30
5.5.60.0070.07317.33
5.5.50.0100.07317.37
5.5.40.0130.07017.29
5.5.30.0130.03317.34
5.5.20.0000.04717.40
5.5.10.0170.03317.35
5.5.00.0070.08317.31
5.4.450.0000.07319.54
5.4.440.0130.04319.47
5.4.430.0070.08319.43
5.4.420.0070.07719.45
5.4.410.0100.06019.54
5.4.400.0030.06019.07
5.4.390.0100.04319.15
5.4.380.0070.08319.11
5.4.370.0170.06719.03
5.4.360.0030.05319.23
5.4.350.0000.08018.98
5.4.340.0030.08019.34
5.4.320.0030.04718.96
5.4.310.0030.07318.96
5.4.300.0000.07019.16
5.4.290.0130.06019.05
5.4.280.0030.05319.26
5.4.270.0130.07018.95
5.4.260.0130.07019.06
5.4.250.0130.03319.18
5.4.240.0100.07018.95
5.4.230.0070.07019.11
5.4.220.0070.04719.14
5.4.210.0130.07319.18
5.4.200.0100.05319.13
5.4.190.0100.04019.25
5.4.180.0000.04319.25
5.4.170.0100.06719.01
5.4.160.0070.06719.23
5.4.150.0030.04319.24
5.4.140.0030.07316.61
5.4.130.0100.05316.43
5.4.120.0070.06016.43
5.4.110.0130.03016.54
5.4.100.0070.03316.56
5.4.90.0030.04016.50
5.4.80.0030.04316.53
5.4.70.0070.03316.51
5.4.60.0070.04016.49
5.4.50.0030.05716.68
5.4.40.0200.05716.54
5.4.30.0030.05316.56
5.4.20.0030.04316.52
5.4.10.0070.06716.47
5.4.00.0170.07016.00
5.3.290.0070.06014.84
5.3.280.0100.03314.77
5.3.270.0070.08014.88
5.3.260.0100.07314.74
5.3.250.0070.08014.67
5.3.240.0030.04014.62
5.3.230.0070.06314.88
5.3.220.0030.07014.71
5.3.210.0070.04014.85
5.3.200.0070.03714.63
5.3.190.0070.07714.83
5.3.180.0100.03714.70
5.3.170.0000.05714.63
5.3.160.0000.05014.88
5.3.150.0100.07014.79
5.3.140.0100.08014.64
5.3.130.0230.05714.83
5.3.120.0100.04314.86
5.3.110.0070.06714.69
5.3.100.0030.05314.26
5.3.90.0070.07014.12
5.3.80.0130.06014.17
5.3.70.0070.06714.18
5.3.60.0070.04014.30
5.3.50.0000.06313.94
5.3.40.0100.06014.12
5.3.30.0130.06714.04
5.3.20.0070.06013.70
5.3.10.0030.07313.73
5.3.00.0070.07313.81
5.2.170.0070.06311.40
5.2.160.0030.06311.28
5.2.150.0070.06011.36
5.2.140.0030.06311.16
5.2.130.0100.05711.32
5.2.120.0070.06711.09
5.2.110.0100.06011.28
5.2.100.0100.04711.28
5.2.90.0130.05311.36
5.2.80.0070.05711.21
5.2.70.0100.04311.17
5.2.60.0030.04311.18
5.2.50.0030.05011.15
5.2.40.0070.05711.01
5.2.30.0070.06011.12
5.2.20.0130.05311.10
5.2.10.0130.05310.99
5.2.00.0070.05010.98
5.1.60.0070.04010.30
5.1.50.0130.03710.25
5.1.40.0070.05010.13
5.1.30.0030.06010.46
5.1.20.0000.03010.44
5.1.10.0070.05310.04
5.1.00.0100.05010.17
5.0.50.0030.0308.55
5.0.40.0000.0478.38
5.0.30.0070.0608.19
5.0.20.0030.0208.29
5.0.10.0000.0278.22
5.0.00.0030.0378.15
4.4.90.0000.0337.29
4.4.80.0000.0377.29
4.4.70.0030.0177.29
4.4.60.0000.0377.29
4.4.50.0070.0277.29
4.4.40.0000.0607.29
4.4.30.0000.0407.29
4.4.20.0000.0177.29
4.4.10.0000.0377.29
4.4.00.0030.0307.29
4.3.110.0000.0377.29
4.3.100.0000.0207.29
4.3.90.0100.0237.29
4.3.80.0000.0307.29
4.3.70.0000.0177.29
4.3.60.0030.0337.29
4.3.50.0070.0177.29
4.3.40.0000.0337.29
4.3.30.0030.0277.29
4.3.20.0000.0337.29
4.3.10.0000.0377.29
4.3.00.0070.0337.29

preferences:
42.95 ms | 401 KiB | 5 Q