3v4l.org

run code in 300+ PHP versions simultaneously
<?php 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; } if (is_int($offset)) { return new self($this->xml[$offset]->asXML(), false); } var_dump($this->xml->$offset->asXML()); return new self($this->xml->$offset->asXML(), false); } 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']; var_dump($xml['note']['recursive']['val']);

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.0000.01817.00
8.3.50.0080.00722.11
8.3.40.0090.00618.93
8.3.30.0040.01119.46
8.3.20.0030.00620.41
8.3.10.0080.00023.64
8.3.00.0090.00319.50
8.2.180.0040.01116.88
8.2.170.0040.01122.96
8.2.160.0120.00620.61
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00422.50
8.2.110.0090.00022.57
8.2.100.0060.00618.09
8.2.90.0040.00419.47
8.2.80.0040.00418.18
8.2.70.0000.00817.75
8.2.60.0060.00618.41
8.2.50.0050.00518.07
8.2.40.0090.00018.47
8.2.30.0050.00218.46
8.2.20.0080.00018.15
8.2.10.0040.00418.03
8.2.00.0040.00418.14
8.1.280.0130.00925.92
8.1.270.0110.00024.08
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0090.00024.04
8.1.230.0040.00719.42
8.1.220.0060.00318.03
8.1.210.0000.00818.77
8.1.200.0030.00717.47
8.1.190.0050.00317.78
8.1.180.0030.00518.10
8.1.170.0070.00318.91
8.1.160.0000.00722.26
8.1.150.0040.00418.84
8.1.140.0020.00517.74
8.1.130.0070.00018.09
8.1.120.0000.00717.61
8.1.110.0040.00417.62
8.1.100.0040.00417.71
8.1.90.0040.00417.66
8.1.80.0000.00817.65
8.1.70.0070.00317.65
8.1.60.0050.00217.69
8.1.50.0090.00017.79
8.1.40.0060.00317.80
8.1.30.0030.00517.82
8.1.20.0040.00417.84
8.1.10.0000.00817.77
8.1.00.0050.00517.68
8.0.300.0040.00418.77
8.0.290.0040.00417.55
8.0.280.0050.00218.71
8.0.270.0070.00017.61
8.0.260.0030.00517.16
8.0.250.0040.00417.12
8.0.240.0000.00717.27
8.0.230.0040.00417.18
8.0.220.0000.00817.23
8.0.210.0040.00317.05
8.0.200.0070.00017.18
8.0.190.0000.00717.30
8.0.180.0090.00017.15
8.0.170.0040.00417.09
8.0.160.0050.00317.21
8.0.150.0040.00416.96
8.0.140.0030.00517.06
8.0.130.0040.00413.59
8.0.120.0050.00317.11
8.0.110.0040.00417.13
8.0.100.0000.00717.15
8.0.90.0040.00417.28
8.0.80.0190.00317.09
8.0.70.0030.00517.04
8.0.60.0040.00417.05
8.0.50.0050.00317.05
8.0.30.0150.00817.34
8.0.20.0090.00917.52
8.0.10.0000.00817.32
8.0.00.0050.01216.95
7.4.330.0060.00015.29
7.4.320.0030.00316.86
7.4.300.0050.00316.72
7.4.290.0040.00416.77
7.4.280.0040.00416.84
7.4.270.0030.00316.80
7.4.260.0050.00216.74
7.4.250.0050.00316.75
7.4.240.0030.00416.93
7.4.230.0080.00016.82
7.4.220.0060.01216.85
7.4.210.0040.01316.86
7.4.200.0070.00016.61
7.4.190.0040.00416.76
7.4.160.0030.01416.68
7.4.150.0150.00417.40
7.4.140.0100.00817.86
7.4.130.0080.00916.83
7.4.120.0110.00716.82
7.4.110.0070.01616.88
7.4.100.0060.01216.81
7.4.90.0120.00616.68
7.4.80.0070.01419.39
7.4.70.0060.01516.82
7.4.60.0100.00716.57
7.4.50.0040.00416.81
7.4.40.0030.00622.77
7.4.30.0090.00616.64
7.4.00.0090.00614.94
7.3.330.0020.00213.45
7.3.320.0030.00313.45
7.3.310.0000.00716.70
7.3.300.0070.00016.70
7.3.290.0030.01116.65
7.3.280.0110.00816.62
7.3.270.0100.01017.40
7.3.260.0060.01216.60
7.3.250.0030.01816.89
7.3.240.0040.01516.64
7.3.230.0120.00916.86
7.3.210.0060.01116.62
7.3.200.0140.00619.39
7.3.190.0090.01516.53
7.3.180.0030.01416.68
7.3.170.0080.00816.60
7.3.160.0100.01016.86
7.3.120.0090.00615.11
7.2.330.0000.01716.98
7.2.320.0070.01017.01
7.2.310.0200.00317.03
7.2.300.0060.01217.00
7.2.290.0090.01217.00
7.2.60.0080.00417.14
7.1.200.0060.00615.94
7.1.70.0060.00317.16
7.1.60.0070.00719.31
7.1.50.0110.01416.76
7.1.00.0030.07322.45
7.0.200.0000.00716.76
7.0.140.0030.07322.23
7.0.60.0070.07720.05
7.0.50.0000.05718.07
7.0.40.0070.04320.20
7.0.30.0330.07320.40
7.0.20.0330.08020.32
7.0.10.0370.07320.28
7.0.00.0070.08020.27
5.6.280.0000.07721.05
5.6.210.0070.04320.86
5.6.200.0100.08018.36
5.6.190.0070.07320.86
5.6.180.0170.07020.61
5.6.170.0330.05020.61
5.6.160.0130.07720.54
5.6.150.0070.05018.37
5.6.140.0000.05018.37
5.6.130.0100.05318.37
5.6.120.0000.04321.21
5.6.110.0100.06321.19
5.6.100.0230.06721.14
5.6.90.0030.06721.04
5.6.80.0070.07320.54
5.6.70.0300.06720.57
5.5.350.0000.06720.59
5.5.340.0030.04718.12
5.5.330.0030.08720.59
5.5.320.0030.08320.39
5.5.310.0300.04320.43
5.5.300.0000.04718.08
5.5.290.0070.08018.07
5.5.280.0030.06320.91
5.5.270.0070.07320.89
5.5.260.0100.03720.77
5.5.250.0100.08320.64
5.5.240.0030.05020.26
5.4.450.0800.04319.43
5.4.440.0670.06019.76
5.4.430.0670.05719.49
5.4.420.0670.05719.36
5.4.410.0100.05319.62
5.4.400.0170.05019.40
5.4.390.0130.05719.32
5.4.380.0130.06318.57
5.4.370.0070.07318.90
5.4.360.0370.06318.77
5.4.350.0270.07318.57
5.4.340.0200.06718.79
5.4.320.0160.04512.70
5.4.310.0060.03812.70
5.4.300.0110.03612.70
5.4.290.0040.03912.69
5.4.280.0040.05412.59
5.4.270.0040.03812.59
5.4.260.0090.04212.59
5.4.250.0080.04512.59
5.4.240.0080.03712.59
5.4.230.0050.03812.58
5.4.220.0100.04312.59
5.4.210.0060.03912.58
5.4.200.0050.03812.58
5.4.190.0140.04712.57
5.4.180.0220.04312.57
5.4.170.0210.04112.58
5.4.160.0210.04412.58
5.4.150.0230.04312.57
5.4.140.0220.04812.25
5.4.130.0200.04312.24
5.4.120.0250.06812.20
5.4.110.0210.04012.20
5.4.100.0140.04812.20
5.4.90.0110.04812.20
5.4.80.0220.03912.19
5.4.70.0210.04112.19
5.4.60.0110.04712.19
5.4.50.0200.03812.19
5.4.40.0120.05112.18
5.4.30.0140.04912.18
5.4.20.0200.04212.18
5.4.10.0170.04312.18
5.4.00.0110.04511.67
5.3.290.0070.04712.96
5.3.280.0120.04412.89
5.3.270.0190.04612.88
5.3.260.0140.04912.89
5.3.250.0160.04712.88
5.3.240.0120.05112.88
5.3.230.0150.04912.88
5.3.220.0160.04912.85
5.3.210.0160.04912.85
5.3.200.0200.04612.84
5.3.190.0200.04412.85
5.3.180.0180.04612.84
5.3.170.0170.04812.84
5.3.160.0190.04312.84
5.3.150.0190.04212.84
5.3.140.0170.04412.85
5.3.130.0140.04812.83
5.3.120.0150.04712.83
5.3.110.0230.04012.82
5.3.100.0110.05012.32
5.3.90.0170.04212.30
5.3.80.0170.04512.29
5.3.70.0190.04212.29
5.3.60.0140.04712.27
5.3.50.0190.04212.21
5.3.40.0220.03912.21
5.3.30.0100.04912.18
5.3.20.0150.04511.96
5.3.10.0190.03911.93
5.3.00.0170.04211.91
5.2.170.0130.0359.42
5.2.160.0090.0389.42
5.2.150.0160.0329.42
5.2.140.0170.0329.42
5.2.130.0130.0369.38
5.2.120.0230.0259.38
5.2.110.0140.0389.37
5.2.100.0140.0359.38
5.2.90.0120.0389.38
5.2.80.0090.0399.37
5.2.70.0130.0369.37
5.2.60.0110.0369.32
5.2.50.0130.0359.29
5.2.40.0120.0369.27
5.2.30.0120.0369.24
5.2.20.0130.0359.23
5.2.10.0110.0369.14
5.2.00.0130.0348.99
5.1.60.0070.0338.28
5.1.50.0140.0278.27
5.1.40.0130.0278.25
5.1.30.0110.0328.61
5.1.20.0160.0338.59
5.1.10.0170.0338.16
5.1.00.0270.0818.17
5.0.50.0120.0236.65
5.0.40.0130.0256.50
5.0.30.0130.0396.32
5.0.20.0080.0296.29
5.0.10.0170.0206.27
5.0.00.0120.0436.26
4.4.90.0230.0674.78
4.4.80.0050.0224.75
4.4.70.0100.0214.75
4.4.60.0140.0194.75
4.4.50.0060.0204.77
4.4.40.0070.0304.71
4.4.30.0100.0204.76
4.4.20.0090.0194.84
4.4.10.0090.0204.84
4.4.00.0080.0304.76
4.3.110.0110.0164.67
4.3.100.0080.0164.66
4.3.90.0070.0174.63
4.3.80.0090.0264.58
4.3.70.0070.0174.63
4.3.60.0090.0164.62
4.3.50.0080.0184.63
4.3.40.0060.0284.54
4.3.30.0060.0213.30
4.3.20.0080.0173.27
4.3.10.0060.0173.24
4.3.00.0270.01715.63

preferences:
46.82 ms | 401 KiB | 5 Q