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']; $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.70.0270.00916.88
8.3.60.0070.01117.38
8.3.50.0100.01022.04
8.3.40.0120.00319.13
8.3.30.0070.01019.33
8.3.20.0040.00420.44
8.3.10.0020.00523.81
8.3.00.0060.00319.51
8.2.180.0120.00616.75
8.2.170.0090.00622.96
8.2.160.0070.01420.82
8.2.150.0060.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0000.00822.64
8.2.110.0170.00322.46
8.2.100.0090.00318.09
8.2.90.0030.00619.60
8.2.80.0040.00418.28
8.2.70.0030.00517.75
8.2.60.0040.00418.15
8.2.50.0000.01018.07
8.2.40.0040.00418.53
8.2.30.0040.00418.48
8.2.20.0060.00318.13
8.2.10.0060.00318.38
8.2.00.0030.00618.15
8.1.280.0060.01225.92
8.1.270.0040.00422.13
8.1.260.0060.00326.35
8.1.250.0080.00028.09
8.1.240.0090.00024.21
8.1.230.0080.00319.46
8.1.220.0030.00517.80
8.1.210.0040.00418.77
8.1.200.0070.00617.73
8.1.190.0000.00817.66
8.1.180.0060.00318.10
8.1.170.0080.00018.68
8.1.160.0020.00522.40
8.1.150.0070.00018.82
8.1.140.0050.00317.68
8.1.130.0000.00818.07
8.1.120.0030.00617.71
8.1.110.0030.00517.72
8.1.100.0000.00717.73
8.1.90.0040.00417.80
8.1.80.0000.00717.72
8.1.70.0000.00817.66
8.1.60.0060.00317.71
8.1.50.0040.00417.80
8.1.40.0050.00317.73
8.1.30.0000.00817.90
8.1.20.0040.00417.85
8.1.10.0040.00417.91
8.1.00.0000.00917.78
8.0.300.0000.00718.77
8.0.290.0060.00317.28
8.0.280.0030.00318.73
8.0.270.0000.00717.48
8.0.260.0030.00317.09
8.0.250.0000.00617.17
8.0.240.0030.00317.25
8.0.230.0030.00317.19
8.0.220.0070.00017.18
8.0.210.0060.00317.20
8.0.200.0040.00417.25
8.0.190.0030.00517.20
8.0.180.0040.00417.02
8.0.170.0040.00417.17
8.0.160.0000.00817.17
8.0.150.0040.00416.98
8.0.140.0040.00417.04
8.0.130.0000.00513.55
8.0.120.0030.00617.07
8.0.110.0000.00817.22
8.0.100.0050.00317.16
8.0.90.0030.00517.17
8.0.80.0070.00717.08
8.0.70.0040.00417.19
8.0.60.0040.00417.21
8.0.50.0040.00417.05
8.0.30.0150.00417.08
8.0.20.0120.00717.41
8.0.10.0040.00417.35
8.0.00.0110.00817.04
7.4.330.0050.00015.45
7.4.320.0000.00616.76
7.4.300.0030.00316.86
7.4.290.0120.00016.79
7.4.280.0000.00816.63
7.4.270.0030.00316.92
7.4.260.0000.00816.72
7.4.250.0040.00416.90
7.4.240.0020.00516.89
7.4.230.0000.00716.67
7.4.220.0000.01716.80
7.4.210.0080.00916.87
7.4.200.0000.00716.98
7.4.190.0040.00417.02
7.4.160.0120.00416.52
7.4.150.0160.00417.40
7.4.140.0080.01317.86
7.4.130.0100.01016.69
7.4.120.0110.00616.92
7.4.110.0090.00816.86
7.4.100.0060.01516.82
7.4.90.0060.01116.65
7.4.80.0130.00719.39
7.4.70.0000.01916.66
7.4.60.0040.01216.74
7.4.50.0020.00216.81
7.4.40.0110.00422.77
7.4.30.0140.00316.89
7.4.00.0060.00915.04
7.3.330.0050.00013.52
7.3.320.0030.00313.66
7.3.310.0050.00316.68
7.3.300.0040.00416.47
7.3.290.0120.00616.65
7.3.280.0040.01516.65
7.3.270.0110.00717.40
7.3.260.0060.01116.71
7.3.250.0090.01116.66
7.3.240.0060.01216.66
7.3.230.0090.00916.89
7.3.210.0130.00616.61
7.3.200.0120.00619.39
7.3.190.0100.00716.98
7.3.180.0060.01016.98
7.3.170.0060.01016.68
7.3.160.0100.00716.68
7.3.120.0090.00615.09
7.3.00.0060.00616.74
7.2.330.0140.00417.08
7.2.320.0050.01516.78
7.2.310.0060.01116.77
7.2.300.0100.00717.01
7.2.290.0070.01116.71
7.2.130.0100.00717.08
7.2.120.0090.00316.87
7.2.110.0030.00616.94
7.2.100.0130.00317.09
7.2.90.0080.00316.95
7.2.80.0070.01116.95
7.2.70.0080.00817.08
7.2.60.0080.00816.99
7.2.50.0090.00017.10
7.2.40.0090.00617.06
7.2.30.0040.00917.05
7.2.20.0060.00617.07
7.2.10.0060.01017.06
7.2.00.0080.00618.30
7.1.250.0030.00515.61
7.1.240.0070.00415.83
7.1.230.0060.00615.93
7.1.220.0070.00716.03
7.1.210.0030.00915.84
7.1.200.0070.00315.82
7.1.190.0030.01015.78
7.1.180.0000.01615.81
7.1.170.0060.00615.79
7.1.160.0070.00715.99
7.1.150.0040.01215.83
7.1.140.0070.00615.84
7.1.130.0130.01115.85
7.1.120.0060.00616.08
7.1.110.0080.00415.84
7.1.100.0070.00417.10
7.1.90.0060.00915.86
7.1.80.0060.00715.82
7.1.70.0030.00716.66
7.1.60.0060.01117.76
7.1.50.0120.00616.43
7.1.40.0070.00715.73
7.1.30.0100.00215.94
7.1.20.0090.00915.81
7.1.10.0110.00215.75
7.1.00.0130.03519.25
7.0.330.0030.00615.16
7.0.320.0030.00715.64
7.0.310.0030.00915.57
7.0.300.0080.00415.55
7.0.290.0030.00715.49
7.0.280.0000.01115.58
7.0.270.0120.00315.43
7.0.260.0090.00315.49
7.0.250.0070.00715.46
7.0.240.0130.00315.51
7.0.230.0050.00515.29
7.0.220.0060.00615.50
7.0.210.0050.00515.40
7.0.200.0030.00516.12
7.0.190.0070.00315.61
7.0.180.0040.00915.45
7.0.170.0140.00315.48
7.0.160.0070.00715.34
7.0.150.0120.00315.38
7.0.140.0080.03718.78
7.0.130.0070.00715.59
7.0.120.0030.00915.70
7.0.110.0060.03117.87
7.0.100.0120.04317.85
7.0.90.0100.04117.74
7.0.80.0100.03417.76
7.0.70.0080.02817.74
7.0.60.0070.02517.76
7.0.50.0030.03517.94
7.0.40.0050.03216.69
7.0.30.0060.04716.60
7.0.20.0080.02516.71
7.0.10.0090.03616.63
7.0.00.0050.04416.63
5.6.380.0070.00314.63
5.6.370.0000.01014.52
5.6.360.0060.00614.70
5.6.350.0060.00314.64
5.6.340.0030.00914.50
5.6.330.0000.01514.51
5.6.320.0070.00414.28
5.6.310.0060.00314.65
5.6.300.0030.00614.40
5.6.290.0000.00914.40
5.6.280.0070.03717.79
5.6.270.0070.00414.37
5.6.260.0050.04317.59
5.6.250.0020.02917.57
5.6.240.0100.04517.54
5.6.230.0100.02317.59
5.6.220.0050.04617.48
5.6.210.0050.02717.60
5.6.200.0100.03817.56
5.6.190.0050.04317.69
5.6.180.0140.02017.45
5.6.170.0050.04517.49
5.6.160.0050.04217.52
5.6.150.0090.03517.50
5.6.140.0050.04017.65
5.6.130.0020.04717.50
5.6.120.0100.02317.71
5.6.110.0060.04317.52
5.6.100.0070.04417.54
5.6.90.0050.04417.43
5.6.80.0040.04317.24
5.6.70.0090.04017.14
5.6.60.0020.04617.18
5.6.50.0050.04517.45
5.6.40.0070.04317.22
5.6.30.0110.03517.37
5.6.20.0040.04317.19
5.6.10.0050.04217.23
5.6.00.0030.03517.32
5.5.380.0050.03715.89
5.5.370.0090.03015.77
5.5.360.0010.04115.95
5.5.350.0080.03815.93
5.5.340.0080.03315.94
5.5.330.0060.04316.19
5.5.320.0080.04216.08
5.5.310.0090.04216.14
5.5.300.0050.02316.20
5.5.290.0030.04916.16
5.5.280.0080.02816.20
5.5.270.0060.04216.25
5.5.260.0020.04516.16
5.5.250.0000.05315.90
5.5.240.0110.03915.89
5.5.230.0110.03815.83
5.5.220.0050.02815.88
5.5.210.0070.02015.90
5.5.200.0080.03815.79
5.5.190.0030.03015.94
5.5.180.0050.04215.55
5.5.170.0030.00611.20
5.5.160.0050.04415.90
5.5.150.0040.02815.95
5.5.140.0090.04015.83
5.5.130.0050.03715.92
5.5.120.0000.02515.86
5.5.110.0080.02015.50
5.5.100.0050.02515.83
5.5.90.0020.02415.70
5.5.80.0070.02215.87
5.5.70.0020.02315.72
5.5.60.0030.02115.68
5.5.50.0050.02015.68
5.5.40.0070.01715.80
5.5.30.0100.02515.76
5.5.20.0070.03515.79
5.5.10.0020.04315.72
5.5.00.0050.03915.77
5.4.450.0020.04615.55
5.4.440.0060.03715.36
5.4.430.0060.04115.46
5.4.420.0010.04415.43
5.4.410.0100.03715.31
5.4.400.0060.04215.20
5.4.390.0070.03815.40
5.4.380.0050.02515.14
5.4.370.0040.02415.24
5.4.360.0110.03115.37
5.4.350.0130.02815.21
5.4.340.0080.04015.21
5.4.330.0030.00611.08
5.4.320.0050.04015.37
5.4.310.0060.03815.07
5.4.300.0030.02514.99
5.4.290.0030.03615.05
5.4.280.0020.02715.16
5.4.270.0030.02415.23
5.4.260.0050.02315.29
5.4.250.0040.02115.13
5.4.240.0020.02215.22
5.4.230.0050.02015.11
5.4.220.0000.02615.13
5.4.210.0050.02415.22
5.4.200.0050.02015.12
5.4.190.0070.03815.19
5.4.180.0100.03315.18
5.4.170.0090.03515.17
5.4.160.0060.03015.23
5.4.150.0060.02414.94
5.4.140.0050.02213.78
5.4.130.0090.01513.83
5.4.120.0050.02013.90
5.4.110.0050.04013.66
5.4.100.0080.01713.89
5.4.90.0020.02013.91
5.4.80.0030.02313.83
5.4.70.0050.01813.88
5.4.60.0040.01713.84
5.4.50.0100.02713.86
5.4.40.0020.02413.91
5.4.30.0050.02213.96
5.4.20.0080.01813.76
5.4.10.0030.02113.88
5.4.00.0020.02913.64
5.3.290.0090.01812.83
5.3.280.0040.02212.69
5.3.270.0040.02912.74
5.3.260.0070.02712.80
5.3.250.0080.02212.78
5.3.240.0050.01812.76
5.3.230.0030.03512.78
5.3.220.0020.04212.61
5.3.210.0030.02112.64
5.3.200.0050.01912.76
5.3.190.0030.02212.71
5.3.180.0000.02112.75
5.3.170.0030.02312.74
5.3.160.0050.01712.80
5.3.150.0040.01912.75
5.3.140.0060.02012.67
5.3.130.0040.02112.78
5.3.120.0020.02412.78
5.3.110.0030.02212.63
5.3.100.0050.02412.45
5.3.90.0050.01912.54
5.3.80.0020.02412.38
5.3.70.0010.02412.34
5.3.60.0030.02012.44
5.3.50.0030.01812.42
5.3.40.0020.02412.38
5.3.30.0070.03012.38
5.3.20.0050.01712.33
5.3.10.0020.01812.04
5.3.00.0000.02212.14
5.2.170.0010.01811.08
5.2.160.0050.02511.08
5.2.150.0020.01511.08
5.2.140.0000.02211.08
5.2.130.0020.01911.08
5.2.120.0030.01511.08
5.2.110.0050.01711.08
5.2.100.0010.01811.08
5.2.90.0030.01711.08
5.2.80.0050.01611.08
5.2.70.0060.01511.08
5.2.60.0030.01711.08
5.2.50.0050.01511.08
5.2.40.0040.01511.08
5.2.30.0090.02811.08
5.2.20.0030.03011.08
5.2.10.0030.02011.08
5.2.00.0070.02811.08
5.1.60.0050.02811.08
5.1.50.0020.02911.08
5.1.40.0070.02311.08
5.1.30.0060.02811.08
5.1.20.0030.03011.08
5.1.10.0050.01511.08
5.1.00.0050.02711.08
5.0.50.0030.02611.08
5.0.40.0050.01811.08
5.0.30.0020.03411.08
5.0.20.0060.01311.08
5.0.10.0020.01411.08
5.0.00.0030.02511.08
4.4.90.0030.00811.08
4.4.80.0020.01011.08
4.4.70.0020.01911.08
4.4.60.0030.02011.08
4.4.50.0020.02011.08
4.4.40.0030.02711.08
4.4.30.0030.02011.08
4.4.20.0030.02011.08
4.4.10.0000.01111.08
4.4.00.0030.02111.08
4.3.110.0060.01811.08
4.3.100.0030.01511.08
4.3.90.0040.01211.08
4.3.80.0020.02811.08
4.3.70.0020.01211.08
4.3.60.0040.01711.08
4.3.50.0020.01711.08
4.3.40.0020.02511.08
4.3.30.0010.01111.08
4.3.20.0040.01711.08
4.3.10.0030.01811.08
4.3.00.0000.01511.08

preferences:
66.63 ms | 401 KiB | 5 Q