3v4l.org

run code in 300+ PHP versions simultaneously
<?php class XmlArrayAccessIterator implements ArrayAccess, IteratorAggregate { private $xml; public function __construct(SimpleXmlIterator $xml) { $this->xml = $xml; } public function offsetExists($offset) { return !is_null($this->xml->$offset); } public function offsetGet($offset) { if ($this->xml->getName() == $offset) { return $this; } if (0 === $xml = $this->xml->$offset) { $xml = $this->xml[$offset]; } return new self($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; } public function __toString() { return (string) $this->xml; } } $xml = '<?xml version="1.0"?> <note> <to>Tove</to> <from>Jani</from> <heading foo="bar">Reminder</heading> <body>Don\'t forget me this weekend!</body> <recursive> <val>2</val> <val>4</val> </recursive> </note>'; $simple = new SimpleXmlIterator($xml); $xml = new XmlArrayAccessIterator($simple); echo $xml['note']['to']; echo $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.0090.00918.68
8.3.50.0130.00622.11
8.3.40.0090.00919.09
8.3.30.0040.01119.09
8.3.20.0080.00018.80
8.3.10.0040.00420.71
8.3.00.0000.00823.79
8.2.180.0150.00617.13
8.2.170.0110.00722.96
8.2.160.0130.00020.53
8.2.150.0060.00324.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0080.00019.61
8.2.110.0000.00922.41
8.2.100.0070.00417.92
8.2.90.0040.00419.40
8.2.80.0000.00818.18
8.2.70.0030.00517.71
8.2.60.0040.00418.30
8.2.50.0040.00418.17
8.2.40.0030.00518.41
8.2.30.0040.00420.04
8.2.20.0040.00417.98
8.2.10.0050.00317.90
8.2.00.0040.00417.98
8.1.280.0140.00425.92
8.1.270.0080.00023.99
8.1.260.0100.00726.35
8.1.250.0040.00428.09
8.1.240.0060.00322.73
8.1.230.0080.00421.15
8.1.220.0080.00018.00
8.1.210.0000.00819.15
8.1.200.0000.00917.60
8.1.190.0000.00917.68
8.1.180.0040.00418.10
8.1.170.0000.00918.75
8.1.160.0000.00819.13
8.1.150.0000.00718.90
8.1.140.0030.00617.64
8.1.130.0000.00717.96
8.1.120.0070.00017.66
8.1.110.0000.00817.71
8.1.100.0040.00417.79
8.1.90.0000.00817.77
8.1.80.0050.00217.75
8.1.70.0070.00017.70
8.1.60.0000.00817.74
8.1.50.0030.00617.71
8.1.40.0000.00817.69
8.1.30.0030.00517.92
8.1.20.0000.00917.88
8.1.10.0040.00417.87
8.1.00.0000.00817.76
8.0.300.0030.00620.34
8.0.290.0000.00717.13
8.0.280.0000.00718.68
8.0.270.0000.00717.60
8.0.260.0000.00717.11
8.0.250.0040.00417.16
8.0.240.0030.00517.19
8.0.230.0030.00317.27
8.0.220.0040.00417.25
8.0.210.0070.00017.26
8.0.200.0000.00717.17
8.0.190.0050.00317.14
8.0.180.0040.00417.19
8.0.170.0060.00317.08
8.0.160.0000.00717.26
8.0.150.0000.01017.17
8.0.140.0040.00417.18
8.0.130.0000.00513.63
8.0.120.0040.00417.16
8.0.110.0000.00717.09
8.0.100.0040.00417.21
8.0.90.0040.00417.08
8.0.80.0190.00317.11
8.0.70.0030.00517.28
8.0.60.0000.00817.18
8.0.50.0040.00417.01
8.0.30.0130.00617.31
8.0.20.0160.00317.40
8.0.10.0040.00417.16
8.0.00.0050.01417.03
7.4.330.0000.00513.43
7.4.320.0080.00016.67
7.4.300.0060.00016.84
7.4.290.0030.00316.91
7.4.280.0050.00516.84
7.4.270.0070.00016.68
7.4.260.0000.00513.62
7.4.250.0070.00016.81
7.4.240.0000.00816.76
7.4.230.0040.00416.74
7.4.220.0090.00916.87
7.4.210.0050.01016.78
7.4.200.0040.00416.73
7.4.190.0000.00716.59
7.4.160.0150.00316.80
7.4.150.0120.00917.40
7.4.140.0110.00717.86
7.4.130.0110.00816.79
7.4.120.0070.01016.76
7.4.110.0060.01216.64
7.4.100.0030.01316.70
7.4.90.0120.01216.63
7.4.80.0100.00719.37
7.4.70.0100.00716.84
7.4.60.0120.00616.53
7.4.50.0090.00016.61
7.4.40.0110.00422.27
7.4.30.0090.00916.59
7.4.00.0050.01015.17
7.3.330.0050.00013.54
7.3.320.0050.00013.37
7.3.310.0000.00716.63
7.3.300.0040.00416.48
7.3.290.0030.01316.64
7.3.280.0070.00916.59
7.3.270.0030.01417.40
7.3.260.0130.00318.24
7.3.250.0160.00416.64
7.3.240.0000.02016.84
7.3.230.0080.00816.69
7.3.210.0060.01016.90
7.3.200.0160.00619.39
7.3.190.0120.00916.59
7.3.180.0150.00716.63
7.3.170.0140.00416.74
7.3.160.0040.01116.75
7.3.120.0070.00915.20
7.3.110.0080.01014.88
7.3.100.0060.00814.83
7.3.90.0040.01215.06
7.3.80.0080.00515.08
7.3.70.0060.00615.07
7.3.60.0050.00915.09
7.3.50.0090.00515.03
7.3.40.0030.01014.83
7.3.30.0090.00314.80
7.3.20.0080.00616.80
7.3.10.0080.00716.78
7.3.00.0080.00616.73
7.2.330.0130.00317.01
7.2.320.0080.00817.08
7.2.310.0100.00716.96
7.2.300.0090.00916.98
7.2.290.0080.00816.97
7.2.250.0070.00715.16
7.2.240.0070.00915.22
7.2.230.0080.01015.24
7.2.220.0080.00715.04
7.2.210.0050.01115.13
7.2.200.0070.01115.24
7.2.190.0090.00715.09
7.2.180.0030.01215.16
7.2.170.0100.00515.20
7.2.160.0100.00715.04
7.2.150.0060.01316.97
7.2.140.0060.00916.87
7.2.130.0050.00716.95
7.2.120.0080.00717.06
7.2.110.0070.00617.07
7.2.100.0080.00917.10
7.2.90.0030.01017.23
7.2.80.0060.00917.06
7.2.70.0110.00317.03
7.2.60.0050.01017.04
7.2.50.0090.00916.95
7.2.40.0080.00517.08
7.2.30.0060.00917.09
7.2.20.0100.00417.16
7.2.10.0110.00717.12
7.2.00.0090.00617.90
7.1.330.0100.00415.93
7.1.320.0040.00715.86
7.1.310.0050.00816.08
7.1.300.0050.00715.84
7.1.290.0020.00815.76
7.1.280.0060.00715.90
7.1.270.0070.00515.94
7.1.260.0050.00815.94
7.1.250.0110.00515.94
7.1.240.0090.00015.72
7.1.230.0030.01015.54
7.1.220.0060.00615.88
7.1.210.0030.01015.70
7.1.200.0050.00615.88
7.1.190.0070.01015.61
7.1.180.0060.00615.70
7.1.170.0070.00715.95
7.1.160.0040.00415.65
7.1.150.0070.00715.94
7.1.140.0030.00616.10
7.1.130.0000.01215.72
7.1.120.0070.00715.69
7.1.110.0040.01115.75
7.1.100.0040.00817.06
7.1.90.0100.00315.96
7.1.80.0060.00915.49
7.1.70.0080.01016.60
7.1.60.0130.01017.69
7.1.50.0080.00816.38
7.1.40.0070.00715.78
7.1.30.0060.00515.93
7.1.20.0000.01115.79
7.1.10.0070.01115.84
7.1.00.0050.03419.15
7.0.330.0030.01015.49
7.0.320.0050.00515.36
7.0.310.0060.00915.34
7.0.300.0000.01115.48
7.0.290.0070.01015.22
7.0.280.0040.00815.27
7.0.270.0060.00615.34
7.0.260.0070.00415.14
7.0.250.0060.00615.38
7.0.240.0030.01015.30
7.0.230.0110.00715.50
7.0.220.0070.00715.58
7.0.210.0070.00715.51
7.0.200.0050.00816.04
7.0.190.0060.00615.52
7.0.180.0070.00415.39
7.0.170.0000.01415.69
7.0.160.0000.01415.71
7.0.150.0060.00615.26
7.0.140.0050.04018.79
7.0.130.0070.00815.61
7.0.120.0040.01115.54
7.0.110.0060.00615.33
7.0.100.0000.01515.23
7.0.90.0150.00015.43
7.0.80.0030.00815.39
7.0.70.0090.00415.41
7.0.60.0050.04518.54
7.0.50.0060.04618.81
7.0.40.0070.03716.94
7.0.30.0070.04416.69
7.0.20.0050.04816.80
7.0.10.0090.04216.67
7.0.00.0060.02416.81
5.6.380.0060.00814.55
5.6.370.0070.00714.59
5.6.360.0040.01114.49
5.6.350.0030.01214.23
5.6.340.0030.00614.32
5.6.330.0060.00614.37
5.6.320.0080.00414.30
5.6.310.0070.00714.59
5.6.300.0130.00014.45
5.6.290.0040.00714.48
5.6.280.0020.04517.84
5.6.270.0120.00014.38
5.6.260.0070.00714.57
5.6.250.0070.00714.62
5.6.240.0030.01414.32
5.6.230.0000.01514.50
5.6.220.0040.01214.34
5.6.210.0060.03717.47
5.6.200.0080.04017.69
5.6.190.0030.04717.70
5.6.180.0100.03717.70
5.6.170.0050.04517.85
5.6.160.0050.04717.82
5.6.150.0030.04017.81
5.6.140.0040.02517.95
5.6.130.0030.04718.00
5.6.120.0050.04817.67
5.6.110.0050.04817.87
5.6.100.0050.03817.88
5.6.90.0060.04517.84
5.6.80.0050.03717.53
5.6.70.0120.03817.33
5.6.60.0090.03217.39
5.6.50.0030.04017.28
5.6.40.0050.02617.35
5.6.30.0060.04317.41
5.6.20.0030.03217.52
5.6.10.0050.03717.39
5.6.00.0020.03317.42
5.5.380.0040.00711.60
5.5.370.0080.00411.60
5.5.360.0000.00711.60
5.5.350.0020.05016.10
5.5.340.0050.04316.35
5.5.330.0020.04516.31
5.5.320.0050.04416.30
5.5.310.0080.04216.24
5.5.300.0060.03816.32
5.5.290.0030.04716.20
5.5.280.0020.04416.26
5.5.270.0050.04616.17
5.5.260.0050.04216.26
5.5.250.0060.03816.21
5.5.240.0030.04615.99
5.5.230.0050.04115.96
5.5.220.0060.04016.00
5.5.210.0030.04616.02
5.5.200.0000.03616.01
5.5.190.0060.02115.97
5.5.180.0040.04215.91
5.5.170.0000.00811.60
5.5.160.0050.02315.98
5.5.150.0020.02315.91
5.5.140.0050.03415.86
5.5.130.0020.03515.87
5.5.120.0070.04016.03
5.5.110.0020.04216.02
5.5.100.0070.03515.90
5.5.90.0060.01915.95
5.5.80.0050.03315.94
5.5.70.0070.02415.86
5.5.60.0000.03015.80
5.5.50.0080.02615.83
5.5.40.0000.02715.93
5.5.30.0020.03215.95
5.5.20.0020.02315.93
5.5.10.0020.02515.83
5.5.00.0050.02215.87
5.4.450.0090.03815.58
5.4.440.0040.02915.50
5.4.430.0050.03715.58
5.4.420.0090.03915.55
5.4.410.0070.04015.51
5.4.400.0100.03715.35
5.4.390.0050.04315.29
5.4.380.0080.03715.29
5.4.370.0040.04015.43
5.4.360.0090.04015.30
5.4.350.0070.02315.34
5.4.340.0030.04115.43
5.4.330.0060.00611.60
5.4.320.0020.03915.40
5.4.310.0040.03215.30
5.4.300.0030.04115.45
5.4.290.0080.04015.31
5.4.280.0120.03115.47
5.4.270.0060.04115.45
5.4.260.0070.03015.37
5.4.250.0030.02415.37
5.4.240.0000.04315.41
5.4.230.0080.02615.46
5.4.220.0020.03215.34
5.4.210.0090.01715.29
5.4.200.0090.03115.40
5.4.190.0030.04015.29
5.4.180.0060.02315.31
5.4.170.0010.02315.31
5.4.160.0020.02215.40
5.4.150.0050.04315.33
5.4.140.0020.02214.09
5.4.130.0090.01014.11
5.4.120.0010.02114.12
5.4.110.0040.04214.07
5.4.100.0020.03814.13
5.4.90.0030.03214.12
5.4.80.0040.03614.02
5.4.70.0000.03914.06
5.4.60.0030.03814.16
5.4.50.0080.03614.07
5.4.40.0020.03014.08
5.4.30.0040.03714.07
5.4.20.0040.03714.07
5.4.10.0020.03514.10
5.4.00.0030.03913.71
5.3.290.0020.02613.26
5.3.280.0020.03613.21
5.3.270.0050.02113.11
5.3.260.0050.03713.10
5.3.250.0060.01513.23
5.3.240.0000.02213.14
5.3.230.0030.03813.14
5.3.220.0030.02513.21
5.3.210.0050.03613.15
5.3.200.0050.03013.22
5.3.190.0030.03813.09
5.3.180.0020.04313.09
5.3.170.0030.04313.15
5.3.160.0000.04313.15
5.3.150.0050.03413.13
5.3.140.0020.03813.15
5.3.130.0000.02413.14
5.3.120.0030.03813.14
5.3.110.0050.03213.21
5.3.100.0080.03512.96
5.3.90.0060.03712.81
5.3.80.0030.03912.84
5.3.70.0040.03912.85
5.3.60.0000.04112.87
5.3.50.0000.03312.85
5.3.40.0050.02212.84
5.3.30.0050.03012.90
5.3.20.0050.02512.72
5.3.10.0050.04012.74
5.3.00.0000.04312.69
5.2.170.0030.03011.43
5.2.160.0050.02011.37
5.2.150.0040.01511.37
5.2.140.0030.03311.41
5.2.130.0040.03011.39
5.2.120.0050.02511.42
5.2.110.0020.03511.47
5.2.100.0050.03211.42
5.2.90.0050.03011.42
5.2.80.0050.03011.43
5.2.70.0010.03511.35
5.2.60.0030.03311.38
5.2.50.0040.01511.31
5.2.40.0050.01311.38
5.2.30.0040.02211.41
5.2.20.0020.03111.35
5.2.10.0020.03011.31
5.2.00.0040.02211.16
5.1.60.0030.01811.02
5.1.50.0040.01711.02
5.1.40.0000.03111.02
5.1.30.0040.02711.10
5.1.20.0030.04011.10
5.1.10.0020.01711.02
5.1.00.0030.02811.02
5.0.50.0020.02511.02
5.0.40.0030.02311.02
5.0.30.0000.03511.02
5.0.20.0070.02011.02
5.0.10.0020.02411.02
5.0.00.0020.03711.02
4.4.90.0030.01211.02
4.4.80.0000.01211.02
4.4.70.0000.01611.02
4.4.60.0020.01011.02
4.4.50.0050.01511.02
4.4.40.0020.02711.02
4.4.30.0020.00811.02
4.4.20.0000.01311.02
4.4.10.0000.01611.02
4.4.00.0020.02711.02
4.3.110.0050.01711.02
4.3.100.0000.01811.02
4.3.90.0000.02011.02
4.3.80.0030.02811.02
4.3.70.0000.01911.02
4.3.60.0010.01811.02
4.3.50.0020.01911.02
4.3.40.0060.02311.02
4.3.30.0020.01811.02
4.3.20.0030.02011.02
4.3.10.0020.01811.02
4.3.00.0020.01811.02

preferences:
58.93 ms | 401 KiB | 5 Q