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)) { $tag = $this->xml->getName(); /*$parent = $this->xml->xpath('../'); $parent = $parent[0];*/ $target = $this->xml->xpath('../' . $tag . '[' . $offset . ']'); var_dump($target); $target = $target[0]; return new self($target->asXML(), false); } 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'][1]);

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.0070.01019.03
8.3.50.0100.00721.33
8.3.40.0150.00019.21
8.3.30.0070.00720.77
8.3.20.0060.00320.52
8.3.10.0030.00521.46
8.3.00.0000.00922.68
8.2.180.0140.00717.13
8.2.170.0080.00822.96
8.2.160.0170.00022.81
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0030.00626.16
8.2.120.0040.00421.25
8.2.110.0070.00420.65
8.2.100.0110.00018.16
8.2.90.0040.00418.38
8.2.80.0040.00419.25
8.2.70.0030.00618.13
8.2.60.0060.00318.25
8.2.50.0040.00418.25
8.2.40.0080.00020.29
8.2.30.0050.00319.73
8.2.20.0080.00018.10
8.2.10.0000.00818.12
8.2.00.0030.00618.05
8.1.280.0180.00425.92
8.1.270.0000.00823.99
8.1.260.0050.00326.35
8.1.250.0030.00628.09
8.1.240.0070.00324.13
8.1.230.0080.00321.27
8.1.220.0060.00319.07
8.1.210.0050.00518.77
8.1.200.0040.00417.85
8.1.190.0030.00517.73
8.1.180.0000.00819.31
8.1.170.0030.00617.75
8.1.160.0040.00419.19
8.1.150.0000.00919.11
8.1.140.0050.00317.87
8.1.130.0000.00718.21
8.1.120.0060.00317.78
8.1.110.0020.00517.80
8.1.100.0000.00717.71
8.1.90.0050.00217.94
8.1.80.0040.00417.92
8.1.70.0040.00417.85
8.1.60.0060.00317.91
8.1.50.0060.00317.93
8.1.40.0050.00317.82
8.1.30.0000.00818.12
8.1.20.0050.00318.14
8.1.10.0060.00318.05
8.1.00.0000.00817.75
8.0.300.0000.00818.77
8.0.290.0000.00917.13
8.0.280.0040.00418.91
8.0.270.0030.00317.60
8.0.260.0050.00318.92
8.0.250.0030.00317.47
8.0.240.0030.00517.37
8.0.230.0070.00017.46
8.0.220.0070.00017.16
8.0.210.0080.00017.38
8.0.200.0050.00317.22
8.0.190.0000.00717.22
8.0.180.0030.00617.44
8.0.170.0040.00417.32
8.0.160.0040.00417.20
8.0.150.0030.00517.13
8.0.140.0030.00617.28
8.0.130.0030.00313.80
8.0.120.0040.00417.29
8.0.110.0020.00517.21
8.0.100.0040.00417.25
8.0.90.0000.00817.27
8.0.80.0000.01517.34
8.0.70.0000.00817.15
8.0.60.0040.00417.27
8.0.50.0030.00517.40
8.0.30.0080.01417.67
8.0.20.0080.01117.45
8.0.10.0040.00417.38
8.0.00.0090.01017.25
7.4.330.0000.00517.10
7.4.320.0030.00516.98
7.4.300.0000.00616.88
7.4.290.0030.00316.89
7.4.280.0070.00017.00
7.4.270.0000.00717.07
7.4.260.0030.00313.67
7.4.250.0040.00417.00
7.4.240.0020.00617.04
7.4.230.0070.00016.85
7.4.220.0120.01517.00
7.4.210.0090.00816.97
7.4.200.0040.00416.95
7.4.190.0030.00317.15
7.4.160.0060.01117.02
7.4.150.0030.01417.40
7.4.140.0050.01417.86
7.4.130.0090.01217.03
7.4.120.0090.00916.96
7.4.110.0090.00916.90
7.4.100.0130.00616.94
7.4.90.0030.01416.98
7.4.80.0170.00019.39
7.4.70.0130.00416.73
7.4.60.0130.00617.06
7.4.50.0040.00417.19
7.4.40.0110.00422.77
7.4.30.0120.00617.04
7.4.00.0100.00714.90
7.3.330.0030.00313.75
7.3.320.0050.00013.77
7.3.310.0000.00716.86
7.3.300.0030.00316.74
7.3.290.0130.00916.73
7.3.280.0110.00716.79
7.3.270.0130.00417.40
7.3.260.0090.00918.24
7.3.250.0050.01416.87
7.3.240.0030.01416.82
7.3.230.0070.01016.95
7.3.210.0060.01316.79
7.3.200.0090.00919.39
7.3.190.0130.00916.71
7.3.180.0100.00716.98
7.3.170.0090.00916.89
7.3.160.0090.00916.95
7.3.120.0080.00815.00
7.3.10.0000.01317.10
7.3.00.0020.00916.82
7.2.330.0090.00917.22
7.2.320.0150.00317.20
7.2.310.0100.01316.91
7.2.300.0040.01717.03
7.2.290.0060.01117.05
7.2.130.0070.00617.15
7.2.120.0040.00617.24
7.2.110.0070.00716.98
7.2.100.0080.00517.15
7.2.90.0020.01217.02
7.2.80.0060.00817.28
7.2.70.0060.00816.93
7.2.60.0070.00916.84
7.2.50.0020.01417.22
7.2.40.0070.00517.05
7.2.30.0060.00817.20
7.2.20.0080.00516.96
7.2.10.0030.01216.86
7.2.00.0050.00916.97
7.1.250.0020.01016.05
7.1.240.0030.00916.08
7.1.230.0040.00715.93
7.1.220.0100.00316.04
7.1.210.0040.00716.01
7.1.200.0050.00515.90
7.1.190.0000.01516.08
7.1.180.0170.00416.09
7.1.170.0100.00716.13
7.1.160.0060.00616.10
7.1.150.0060.00616.10
7.1.140.0040.00716.02
7.1.130.0030.00515.86
7.1.120.0000.01015.87
7.1.110.0060.01215.99
7.1.100.0020.01116.91
7.1.90.0080.00515.85
7.1.80.0080.00416.14
7.1.70.0030.00816.72
7.1.60.0060.01117.58
7.1.50.0080.00916.54
7.1.40.0040.00816.12
7.1.30.0030.00716.00
7.1.20.0060.00615.87
7.1.10.0030.01416.24
7.1.00.0020.04219.35
7.0.330.0050.00315.33
7.0.320.0030.00815.44
7.0.310.0040.00815.61
7.0.300.0100.00515.67
7.0.290.0070.00715.58
7.0.280.0030.00915.41
7.0.270.0030.01015.17
7.0.260.0040.00815.59
7.0.250.0060.00315.66
7.0.240.0030.00715.52
7.0.230.0090.00315.52
7.0.220.0070.00715.62
7.0.210.0040.00415.49
7.0.200.0060.00915.38
7.0.190.0030.01015.59
7.0.180.0000.01215.52
7.0.170.0030.00915.59
7.0.160.0070.00715.75
7.0.150.0110.00315.59
7.0.140.0070.03918.92
7.0.130.0070.00315.94
7.0.120.0060.00915.69
7.0.110.0070.00715.67
7.0.100.0050.02517.71
7.0.90.0100.03017.73
7.0.80.0070.02317.83
7.0.70.0020.02517.70
7.0.60.0080.01818.01
7.0.50.0160.02318.12
7.0.40.0020.02816.89
7.0.30.0020.02316.94
7.0.20.0090.02016.99
7.0.10.0070.01916.91
7.0.00.0080.04216.89
5.6.380.0070.00414.70
5.6.370.0060.00614.76
5.6.360.0000.01114.97
5.6.350.0060.00314.59
5.6.340.0060.00614.66
5.6.330.0040.00714.62
5.6.320.0000.01314.39
5.6.310.0070.00714.39
5.6.300.0000.00714.34
5.6.290.0040.00414.58
5.6.280.0070.03617.84
5.6.270.0030.00614.86
5.6.260.0030.00714.93
5.6.250.0020.02717.66
5.6.240.0030.02717.71
5.6.230.0020.02817.51
5.6.220.0020.04117.70
5.6.210.0080.02317.72
5.6.200.0100.02217.72
5.6.190.0100.02317.95
5.6.180.0050.02117.72
5.6.170.0050.02117.82
5.6.160.0040.04117.77
5.6.150.0060.03617.90
5.6.140.0070.03717.73
5.6.130.0120.04517.83
5.6.120.0100.04418.02
5.6.110.0120.04017.73
5.6.100.0130.02318.11
5.6.90.0070.04517.75
5.6.80.0060.04317.47
5.6.70.0100.04617.58
5.6.60.0050.04617.52
5.6.50.0120.04017.60
5.6.40.0100.03717.70
5.6.30.0090.04317.54
5.6.20.0030.03717.67
5.6.10.0070.04517.66
5.6.00.0090.04517.67
5.5.380.0050.02615.97
5.5.370.0070.02015.93
5.5.360.0050.03116.13
5.5.350.0020.02716.02
5.5.340.0050.02216.17
5.5.330.0060.02116.17
5.5.320.0060.01916.18
5.5.310.0010.02316.16
5.5.300.0070.04316.22
5.5.290.0080.03516.15
5.5.280.0050.04816.23
5.5.270.0120.03216.38
5.5.260.0050.03716.20
5.5.250.0050.02716.08
5.5.240.0030.05015.87
5.5.230.0030.03215.87
5.5.220.0100.04215.84
5.5.210.0050.04115.97
5.5.200.0090.03815.72
5.5.190.0080.04115.90
5.5.180.0080.04115.85
5.5.170.0030.00511.41
5.5.160.0040.04415.80
5.5.150.0070.03315.91
5.5.140.0070.04216.07
5.5.130.0050.02515.72
5.5.120.0040.03415.82
5.5.110.0060.01915.71
5.5.100.0070.02315.73
5.5.90.0050.01915.82
5.5.80.0030.04215.78
5.5.70.0070.02815.84
5.5.60.0050.03315.78
5.5.50.0020.05015.74
5.5.40.0120.04215.79
5.5.30.0050.02515.77
5.5.20.0070.03915.84
5.5.10.0070.02515.87
5.5.00.0050.02715.76
5.4.450.0060.03115.55
5.4.440.0070.04115.25
5.4.430.0090.03715.28
5.4.420.0080.03615.48
5.4.410.0050.03715.44
5.4.400.0110.03615.13
5.4.390.0040.04415.40
5.4.380.0150.03515.30
5.4.370.0100.02515.30
5.4.360.0070.02515.29
5.4.350.0030.04115.17
5.4.340.0000.05015.33
5.4.330.0060.00311.19
5.4.320.0060.04315.36
5.4.310.0150.02315.21
5.4.300.0020.04115.30
5.4.290.0070.04315.29
5.4.280.0080.03315.26
5.4.270.0020.02615.31
5.4.260.0020.02215.32
5.4.250.0020.04315.32
5.4.240.0070.03715.34
5.4.230.0030.04415.23
5.4.220.0070.04015.16
5.4.210.0030.03715.14
5.4.200.0030.04015.22
5.4.190.0030.02515.24
5.4.180.0080.03715.25
5.4.170.0030.04315.22
5.4.160.0030.02515.28
5.4.150.0050.03715.30
5.4.140.0030.04113.91
5.4.130.0040.03914.08
5.4.120.0070.03714.00
5.4.110.0020.04513.99
5.4.100.0050.03814.01
5.4.90.0050.03814.05
5.4.80.0020.02514.06
5.4.70.0050.03013.93
5.4.60.0060.04013.99
5.4.50.0020.03314.00
5.4.40.0100.03014.08
5.4.30.0050.03813.90
5.4.20.0050.02713.96
5.4.10.0080.03713.94
5.4.00.0080.03513.68
5.3.290.0050.04312.93
5.3.280.0070.04212.80
5.3.270.0020.02212.85
5.3.260.0050.04212.82
5.3.250.0040.02112.88
5.3.240.0040.04112.74
5.3.230.0050.02612.79
5.3.220.0070.03712.66
5.3.210.0020.02412.76
5.3.200.0050.03212.77
5.3.190.0110.03312.65
5.3.180.0090.04012.80
5.3.170.0060.02212.79
5.3.160.0060.03312.91
5.3.150.0060.03612.88
5.3.140.0020.04412.70
5.3.130.0070.02512.81
5.3.120.0030.04112.74
5.3.110.0080.03812.81
5.3.100.0040.03512.61
5.3.90.0020.03912.55
5.3.80.0080.03612.56
5.3.70.0050.04012.44
5.3.60.0030.02812.45
5.3.50.0050.04012.49
5.3.40.0030.03812.47
5.3.30.0070.03512.46
5.3.20.0080.03512.37
5.3.10.0000.02512.24
5.3.00.0020.04212.25
5.2.170.0020.03310.71
5.2.160.0050.02210.63
5.2.150.0030.03310.66
5.2.140.0020.02510.65
5.2.130.0040.03010.66
5.2.120.0030.03110.58
5.2.110.0080.03210.64
5.2.100.0080.02510.66
5.2.90.0030.03610.68
5.2.80.0020.02410.59
5.2.70.0050.03310.68
5.2.60.0060.01710.65
5.2.50.0050.02710.56
5.2.40.0070.03010.65
5.2.30.0070.02010.57
5.2.20.0050.02510.57
5.2.10.0020.03610.50
5.2.00.0030.02510.50
5.1.60.0030.03110.09
5.1.50.0030.02810.07
5.1.40.0030.03010.13
5.1.30.0020.02310.26
5.1.20.0030.02510.24
5.1.10.0070.02310.04
5.1.00.0080.02510.06
5.0.50.0020.0259.66
5.0.40.0010.0259.66
5.0.30.0040.0209.66
5.0.20.0040.0239.66
5.0.10.0020.0239.66
5.0.00.0030.0299.66
4.4.90.0030.0189.66
4.4.80.0030.0189.66
4.4.70.0030.0099.66
4.4.60.0020.0209.66
4.4.50.0000.0159.66
4.4.40.0030.0279.66
4.4.30.0030.0189.66
4.4.20.0030.0159.66
4.4.10.0060.0159.66
4.4.00.0020.0299.66
4.3.110.0040.0189.66
4.3.100.0030.0189.66
4.3.90.0000.0189.66
4.3.80.0040.0159.66
4.3.70.0050.0139.66
4.3.60.0030.0189.66
4.3.50.0030.0109.66
4.3.40.0050.0259.66
4.3.30.0020.0199.66
4.3.20.0020.0189.66
4.3.10.0000.0169.66
4.3.00.0020.0219.66

preferences:
57.02 ms | 401 KiB | 5 Q