3v4l.org

run code in 300+ PHP versions simultaneously
<?php class XmlArrayAccessIterator implements ArrayAccess, IteratorAggregate { private $xml; private $filePath; private $isUrl; 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 ($this->xml->$offset->count() > 1) { return new self($this->xml->$offset->asXML(), false); } return $this->xml->$offset; } 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']; //var_dump($xml['note']['recursive']);

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.0060.01518.68
8.3.50.0130.00922.23
8.3.40.0040.01118.90
8.3.30.0070.01118.92
8.3.20.0120.00618.78
8.3.10.0060.00320.82
8.3.00.0070.00417.75
8.2.180.0190.00017.13
8.2.170.0060.01222.96
8.2.160.0000.01422.33
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0120.00426.16
8.2.120.0040.00420.01
8.2.110.0080.00322.45
8.2.100.0060.00618.16
8.2.90.0060.00319.46
8.2.80.0090.00018.17
8.2.70.0000.00817.88
8.2.60.0000.00818.18
8.2.50.0040.00418.18
8.2.40.0000.00818.28
8.2.30.0000.00820.08
8.2.20.0040.00417.98
8.2.10.0050.00317.92
8.2.00.0040.00417.91
8.1.280.0030.01725.92
8.1.270.0050.00223.99
8.1.260.0000.00826.35
8.1.250.0000.00828.09
8.1.240.0000.00922.54
8.1.230.0040.00721.21
8.1.220.0040.00418.77
8.1.210.0070.00419.01
8.1.200.0030.00617.50
8.1.190.0000.00817.64
8.1.180.0030.00518.10
8.1.170.0080.00019.09
8.1.160.0040.00419.11
8.1.150.0050.00218.70
8.1.140.0000.00717.65
8.1.130.0030.00318.02
8.1.120.0040.00417.59
8.1.110.0070.00017.65
8.1.100.0040.00417.70
8.1.90.0040.00417.66
8.1.80.0040.00417.61
8.1.70.0070.00417.57
8.1.60.0060.00317.74
8.1.50.0050.00317.59
8.1.40.0000.00817.73
8.1.30.0060.00317.75
8.1.20.0030.00517.86
8.1.10.0050.00217.76
8.1.00.0050.00317.71
8.0.300.0070.00320.13
8.0.290.0040.00716.88
8.0.280.0030.00318.53
8.0.270.0040.00417.48
8.0.260.0070.00017.09
8.0.250.0020.00517.22
8.0.240.0000.00917.21
8.0.230.0040.00417.31
8.0.220.0030.00317.23
8.0.210.0000.00717.08
8.0.200.0000.00717.32
8.0.190.0000.00817.22
8.0.180.0040.00417.24
8.0.170.0040.00417.08
8.0.160.0030.00617.13
8.0.150.0020.00517.12
8.0.140.0020.00817.09
8.0.130.0060.00013.52
8.0.120.0020.00517.11
8.0.110.0040.00416.96
8.0.100.0000.00717.12
8.0.90.0020.00517.24
8.0.80.0030.01717.02
8.0.70.0070.00017.04
8.0.60.0000.00917.07
8.0.50.0050.00317.22
8.0.30.0090.01017.44
8.0.20.0160.00617.45
8.0.10.0040.00417.35
8.0.00.0080.01017.06
7.4.330.0030.00314.80
7.4.320.0000.00616.77
7.4.300.0000.00716.73
7.4.290.0000.00716.68
7.4.280.0000.00716.82
7.4.270.0030.00316.83
7.4.260.0030.00313.45
7.4.250.0030.00616.58
7.4.240.0000.00816.81
7.4.230.0000.00816.80
7.4.220.0100.01716.71
7.4.210.0090.00716.83
7.4.200.0030.00316.55
7.4.190.0040.00416.99
7.4.160.0100.00716.70
7.4.150.0120.00617.40
7.4.140.0080.00817.86
7.4.130.0100.00716.82
7.4.120.0100.00616.82
7.4.110.0090.00816.82
7.4.100.0190.00616.91
7.4.90.0130.00316.78
7.4.80.0070.01419.04
7.4.70.0090.00616.81
7.4.60.0130.00316.74
7.4.50.0050.00016.91
7.4.40.0100.00722.27
7.4.30.0120.00316.56
7.4.00.0040.01415.26
7.3.330.0030.00313.65
7.3.320.0000.00813.58
7.3.310.0030.00316.45
7.3.300.0050.00316.68
7.3.290.0000.01416.55
7.3.280.0110.00516.56
7.3.270.0090.00917.40
7.3.260.0160.00718.24
7.3.250.0110.00716.55
7.3.240.0130.00416.67
7.3.230.0110.00716.86
7.3.210.0100.00616.73
7.3.200.0070.01419.39
7.3.190.0160.00616.53
7.3.180.0060.01216.50
7.3.170.0080.00816.68
7.3.160.0080.00816.63
7.3.120.0050.00915.12
7.3.110.0080.01115.09
7.3.100.0000.01614.73
7.3.90.0040.01114.66
7.3.80.0030.01014.93
7.3.70.0040.01114.79
7.3.60.0030.01315.11
7.3.50.0030.00914.72
7.3.40.0030.00915.03
7.3.30.0080.00614.80
7.3.20.0040.01216.89
7.3.10.0080.00616.60
7.3.00.0070.00916.63
7.2.330.0060.01216.70
7.2.320.0060.01516.68
7.2.310.0090.01216.80
7.2.300.0160.00816.70
7.2.290.0120.00616.87
7.2.250.0030.01015.25
7.2.240.0030.01414.78
7.2.230.0030.00715.03
7.2.220.0040.01115.32
7.2.210.0070.01015.42
7.2.200.0120.00315.30
7.2.190.0000.01215.04
7.2.180.0030.01015.29
7.2.170.0030.00715.27
7.2.130.0080.00816.79
7.2.120.0070.00816.79
7.2.110.0080.00816.78
7.2.100.0070.00516.90
7.2.90.0050.00716.87
7.2.80.0080.00416.97
7.2.70.0110.00616.95
7.2.60.0080.00816.97
7.2.50.0060.01016.74
7.2.40.0090.01017.01
7.2.30.0070.00816.74
7.2.20.0090.00616.74
7.2.10.0090.00717.02
7.2.00.0090.00717.72
7.1.330.0140.00015.95
7.1.320.0090.00615.98
7.1.310.0030.01015.73
7.1.300.0060.00915.94
7.1.290.0030.00915.87
7.1.280.0070.00715.98
7.1.270.0030.00715.90
7.1.260.0100.00715.87
7.1.250.0050.00715.73
7.1.240.0050.00916.15
7.1.230.0100.01016.15
7.1.220.0110.00516.00
7.1.210.0070.00716.07
7.1.200.0060.00415.80
7.1.190.0060.00915.90
7.1.180.0000.01215.85
7.1.170.0060.00616.02
7.1.160.0040.00815.61
7.1.150.0030.00915.78
7.1.140.0060.00615.91
7.1.130.0050.00215.79
7.1.120.0100.00315.95
7.1.110.0030.00716.04
7.1.100.0310.00715.88
7.1.90.0040.00815.83
7.1.80.0090.00615.84
7.1.70.0020.00916.67
7.1.60.0060.01317.64
7.1.50.0080.01016.43
7.1.40.0000.01116.00
7.1.30.0000.01116.04
7.1.20.0070.00716.18
7.1.10.0030.00716.04
7.1.00.0070.03419.21
7.0.330.0120.00615.50
7.0.320.0050.00515.40
7.0.310.0060.00615.37
7.0.300.0030.01215.54
7.0.290.0030.00715.57
7.0.280.0040.01115.54
7.0.270.0030.00615.46
7.0.260.0060.00615.44
7.0.250.0000.01115.43
7.0.240.0000.01015.43
7.0.230.0040.00415.59
7.0.220.0030.00915.45
7.0.210.0040.00415.65
7.0.200.0030.00516.03
7.0.190.0030.00715.43
7.0.180.0040.00715.44
7.0.170.0040.00815.55
7.0.160.0000.01415.38
7.0.150.0040.00815.63
7.0.140.0020.04418.90
7.0.130.0060.00615.14
7.0.120.0030.00915.45
7.0.110.0040.01115.43
7.0.100.0090.00315.36
7.0.90.0040.00815.57
7.0.80.0030.01315.59
7.0.70.0040.00415.57
7.0.60.0100.04017.76
7.0.50.0050.02716.76
7.0.40.0080.03215.85
7.0.30.0020.04715.80
7.0.20.0080.04015.67
7.0.10.0030.03315.67
7.0.00.0050.03615.68
5.6.380.0060.00914.70
5.6.370.0020.01314.40
5.6.360.0090.00614.63
5.6.350.0000.01614.20
5.6.340.0040.01114.34
5.6.330.0000.01014.62
5.6.320.0030.00914.74
5.6.310.0030.00914.74
5.6.300.0000.01114.64
5.6.290.0000.00914.53
5.6.280.0000.04117.90
5.6.270.0000.00714.19
5.6.260.0030.00614.56
5.6.250.0060.00714.55
5.6.240.0070.00714.11
5.6.230.0040.00814.60
5.6.220.0090.00314.58
5.6.210.0070.04117.45
5.6.200.0070.04216.54
5.6.190.0100.02316.28
5.6.180.0080.04016.38
5.6.170.0030.04616.18
5.6.160.0090.04116.27
5.6.150.0070.03316.30
5.6.140.0090.01816.44
5.6.130.0080.04616.40
5.6.120.0070.03316.38
5.6.110.0030.04916.26
5.6.100.0050.02816.38
5.6.90.0040.02616.13
5.6.80.0030.04316.07
5.6.70.0050.03716.05
5.6.60.0080.03716.09
5.6.50.0100.04116.04
5.6.40.0050.04516.04
5.6.30.0080.03415.99
5.6.20.0070.03116.03
5.6.10.0000.02716.03
5.6.00.0030.03615.98
5.5.380.0050.00211.38
5.5.370.0090.00011.36
5.5.360.0070.00411.39
5.5.350.1920.02515.95
5.5.340.0080.03114.81
5.5.330.0080.02114.80
5.5.320.0050.04314.66
5.5.310.0030.02714.71
5.5.300.0030.03814.68
5.5.290.0070.02514.63
5.5.280.0100.03514.76
5.5.270.0070.03114.67
5.5.260.0070.03814.76
5.5.250.0080.03514.57
5.5.240.0070.03514.41
5.5.230.0030.04514.29
5.5.220.0000.03014.48
5.5.210.0050.02414.40
5.5.200.0020.03314.36
5.5.190.0030.02714.46
5.5.180.0040.03914.35
5.5.170.0070.00311.25
5.5.160.0050.04414.48
5.5.150.0120.02214.45
5.5.140.0050.03814.31
5.5.130.0020.04414.45
5.5.120.0050.04014.33
5.5.110.0030.02214.32
5.5.100.0020.04314.25
5.5.90.0020.02314.21
5.5.80.0050.04114.28
5.5.70.0120.03514.32
5.5.60.0050.02514.31
5.5.50.0080.01714.34
5.5.40.0040.02214.32
5.5.30.0020.02614.21
5.5.20.0040.04214.22
5.5.10.0100.03814.28
5.5.00.0030.04114.31
5.4.450.0020.03315.23
5.4.440.0030.03315.28
5.4.430.0120.03315.34
5.4.420.0050.03815.44
5.4.410.0030.04315.24
5.4.400.0030.03815.17
5.4.390.0080.04015.21
5.4.380.0030.04415.22
5.4.370.0100.03715.20
5.4.360.0030.03615.19
5.4.350.0060.03715.18
5.4.340.0070.02015.10
5.4.330.0040.00711.19
5.4.320.0050.03315.16
5.4.310.0060.04015.17
5.4.300.0110.03515.11
5.4.290.0030.03315.12
5.4.280.0050.04215.24
5.4.270.0080.02515.17
5.4.260.0030.04515.14
5.4.250.0060.03815.13
5.4.240.0060.03715.16
5.4.230.0090.02515.09
5.4.220.0120.03415.16
5.4.210.0060.02215.17
5.4.200.0050.02215.14
5.4.190.0060.02115.17
5.4.180.0050.04215.18
5.4.170.0070.03715.15
5.4.160.0020.03815.17
5.4.150.0090.03115.14
5.4.140.0070.03913.90
5.4.130.0050.04113.95
5.4.120.0050.02913.79
5.4.110.0030.04313.85
5.4.100.0080.03813.89
5.4.90.0050.03813.92
5.4.80.0050.03713.85
5.4.70.0080.03613.84
5.4.60.0050.03813.86
5.4.50.0050.04213.85
5.4.40.0080.03813.87
5.4.30.0100.02813.82
5.4.20.0070.03413.91
5.4.10.0070.02713.84
5.4.00.0050.03713.62
5.3.290.0030.04412.92
5.3.280.0110.03212.95
5.3.270.0030.04012.95
5.3.260.0020.04013.00
5.3.250.0060.03212.96
5.3.240.0020.04512.96
5.3.230.0000.04012.95
5.3.220.0050.02812.93
5.3.210.0070.03512.94
5.3.200.0020.04012.94
5.3.190.0070.02212.93
5.3.180.0080.03712.93
5.3.170.0030.03712.93
5.3.160.0060.04112.97
5.3.150.0070.04012.88
5.3.140.0030.04412.93
5.3.130.0070.04012.92
5.3.120.0100.03512.92
5.3.110.0070.03312.92
5.3.100.0070.03512.74
5.3.90.0030.03712.62
5.3.80.0070.02512.73
5.3.70.0030.03812.62
5.3.60.0030.03712.65
5.3.50.0050.03512.62
5.3.40.0100.03812.63
5.3.30.0070.03312.67
5.3.20.0030.03912.49
5.3.10.0050.03612.46
5.3.00.0030.04012.51
5.2.170.0020.02311.22
5.2.160.0020.03011.22
5.2.150.0010.03511.22
5.2.140.0020.02711.21
5.2.130.0050.02511.20
5.2.120.0060.03311.21
5.2.110.0050.03411.21
5.2.100.0020.02311.20
5.2.90.0040.01811.24
5.2.80.0060.01311.23
5.2.70.0050.02011.20
5.2.60.0020.01711.11
5.2.50.0020.02511.17
5.2.40.0050.02811.19
5.2.30.0070.02911.13
5.2.20.0070.02211.09
5.2.10.0060.02811.10
5.2.00.0050.02611.00
5.1.60.0030.02110.65
5.1.50.0080.01310.64
5.1.40.0010.03110.71
5.1.30.0030.03110.81
5.1.20.0030.03210.77
5.1.10.0060.02710.66
5.1.00.0030.03010.67
5.0.50.0030.0249.86
5.0.40.0030.0239.82
5.0.30.0020.0359.74
5.0.20.0020.0239.70
5.0.10.0030.0229.71
5.0.00.0000.0399.71
4.4.90.0060.0099.54
4.4.80.0000.0129.54
4.4.70.0020.0179.54
4.4.60.0000.0199.54
4.4.50.0030.0189.54
4.4.40.0020.0289.54
4.4.30.0020.0129.54
4.4.20.0020.0129.54
4.4.10.0020.0129.54
4.4.00.0020.0289.54
4.3.110.0020.0199.54
4.3.100.0040.0139.54
4.3.90.0050.0179.54
4.3.80.0020.0289.54
4.3.70.0040.0129.54
4.3.60.0040.0179.54
4.3.50.0050.0189.54
4.3.40.0070.0179.54
4.3.30.0050.0179.54
4.3.20.0000.0239.54
4.3.10.0040.0189.54
4.3.00.0030.0189.54

preferences:
55.92 ms | 401 KiB | 5 Q