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; } return (array) $this->xml->$offset;//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'][0]; 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.0030.01618.77
8.3.50.0050.01321.15
8.3.40.0090.00619.18
8.3.30.0070.00720.60
8.3.20.0080.00020.45
8.3.10.0040.00422.21
8.3.00.0000.00822.55
8.2.180.0250.00416.97
8.2.170.0140.00022.96
8.2.160.0100.00322.42
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0000.00826.16
8.2.120.0080.00020.80
8.2.110.0060.00319.39
8.2.100.0070.00418.41
8.2.90.0050.00319.45
8.2.80.0050.00319.56
8.2.70.0060.00317.88
8.2.60.0000.00818.18
8.2.50.0030.00618.07
8.2.40.0050.00318.40
8.2.30.0040.00419.74
8.2.20.0040.00417.89
8.2.10.0040.00418.00
8.2.00.0030.00618.12
8.1.280.0100.01025.92
8.1.270.0050.00523.99
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0090.00024.08
8.1.230.0000.01121.17
8.1.220.0000.00918.77
8.1.210.0050.00319.25
8.1.200.0060.00317.47
8.1.190.0090.00017.78
8.1.180.0030.00518.10
8.1.170.0000.00818.74
8.1.160.0040.00419.13
8.1.150.0000.00718.87
8.1.140.0000.00717.58
8.1.130.0110.00017.95
8.1.120.0040.00417.75
8.1.110.0020.00517.72
8.1.100.0030.00517.67
8.1.90.0080.00017.61
8.1.80.0000.00717.61
8.1.70.0030.00317.60
8.1.60.0040.00417.70
8.1.50.0080.00017.77
8.1.40.0050.00517.77
8.1.30.0040.00417.88
8.1.20.0040.00417.75
8.1.10.0050.00317.73
8.1.00.0000.00817.69
8.0.300.0070.00020.05
8.0.290.0080.00017.43
8.0.280.0030.00318.71
8.0.270.0080.00017.55
8.0.260.0000.01017.16
8.0.250.0030.00617.17
8.0.240.0050.00517.21
8.0.230.0040.00417.16
8.0.220.0030.00317.08
8.0.210.0000.00717.16
8.0.200.0030.00317.20
8.0.190.0000.00717.16
8.0.180.0070.00017.12
8.0.170.0040.00417.06
8.0.160.0040.00416.96
8.0.150.0040.00417.10
8.0.140.0040.00817.10
8.0.130.0000.00613.57
8.0.120.0080.00016.99
8.0.110.0050.00217.13
8.0.100.0070.00017.15
8.0.90.0040.00417.06
8.0.80.0060.01017.04
8.0.70.0040.00417.19
8.0.60.0000.00816.98
8.0.50.0060.00317.14
8.0.30.0080.01117.41
8.0.20.0080.01117.40
8.0.10.0040.00417.29
8.0.00.0110.00917.11
7.4.330.0030.00316.87
7.4.320.0030.00316.70
7.4.300.0000.00716.77
7.4.290.0030.00316.74
7.4.280.0040.00416.61
7.4.270.0030.00316.82
7.4.260.0000.00513.52
7.4.250.0040.00416.81
7.4.240.0040.00416.84
7.4.230.0000.00716.89
7.4.220.0030.02216.94
7.4.210.0070.00916.77
7.4.200.0000.00716.57
7.4.190.0040.00416.91
7.4.160.0030.01316.75
7.4.150.0030.01417.40
7.4.140.0090.00917.86
7.4.130.0090.00716.97
7.4.120.0120.00916.76
7.4.110.0000.01916.70
7.4.100.0130.00316.66
7.4.90.0140.00316.71
7.4.80.0100.01019.39
7.4.70.0030.01316.63
7.4.60.0140.00316.66
7.4.50.0040.00416.80
7.4.40.0120.00622.77
7.4.30.0030.01316.82
7.4.00.0050.01315.25
7.3.330.0050.00013.40
7.3.320.0060.00013.56
7.3.310.0070.00016.63
7.3.300.0030.00316.59
7.3.290.0070.00716.56
7.3.280.0070.01016.54
7.3.270.0070.01017.40
7.3.260.0200.00318.24
7.3.250.0070.01116.81
7.3.240.0070.01016.60
7.3.230.0100.01316.54
7.3.210.0120.00616.86
7.3.200.0090.01119.39
7.3.190.0000.01716.58
7.3.180.0070.01116.57
7.3.170.0100.00716.80
7.3.160.0150.00616.79
7.3.120.0090.00714.87
7.3.110.0060.00914.93
7.3.100.0070.00914.91
7.3.90.0120.00315.09
7.3.80.0070.00614.91
7.3.70.0060.00514.90
7.3.60.0060.00715.03
7.3.50.0050.00814.93
7.3.40.0060.01015.00
7.3.30.0060.00414.92
7.3.20.0070.00616.75
7.3.10.0090.00716.87
7.3.00.0050.00816.84
7.2.330.0100.00716.75
7.2.320.0160.00616.98
7.2.310.0030.01316.73
7.2.300.0060.01016.97
7.2.290.0070.01017.02
7.2.250.0100.01015.24
7.2.240.0040.01415.02
7.2.230.0070.01015.14
7.2.220.0060.01115.26
7.2.210.0030.01215.16
7.2.200.0030.01215.17
7.2.190.0020.01315.30
7.2.180.0070.00715.21
7.2.170.0060.00815.29
7.2.160.0040.00715.34
7.2.150.0030.01316.93
7.2.140.0000.01417.06
7.2.130.0070.01017.00
7.2.120.0090.00617.18
7.2.110.0030.00916.88
7.2.100.0000.01417.16
7.2.90.0150.00016.93
7.2.80.0140.00317.20
7.2.70.0000.01516.90
7.2.60.0070.00716.92
7.2.50.0100.00317.05
7.2.40.0070.00717.01
7.2.30.0060.00917.24
7.2.20.0120.00316.94
7.2.10.0090.00917.14
7.2.00.0040.00717.40
7.1.330.0080.00815.93
7.1.320.0090.00416.03
7.1.310.0050.00515.78
7.1.300.0060.00315.82
7.1.290.0060.00615.81
7.1.280.0050.00915.93
7.1.270.0060.00615.97
7.1.260.0050.01115.92
7.1.250.0090.00015.82
7.1.240.0070.00715.95
7.1.230.0060.00815.97
7.1.220.0030.01015.98
7.1.210.0070.00716.18
7.1.200.0090.00615.95
7.1.190.0060.00615.91
7.1.180.0120.00315.82
7.1.170.0000.01515.86
7.1.160.0080.00815.67
7.1.150.0060.00615.63
7.1.140.0070.00716.15
7.1.130.0090.00316.04
7.1.120.0110.00315.89
7.1.110.0030.01016.02
7.1.100.0030.00917.03
7.1.90.0070.00716.18
7.1.80.0000.01615.68
7.1.70.0040.00816.61
7.1.60.0050.00817.44
7.1.50.0090.00916.60
7.1.40.0040.01215.79
7.1.30.0030.00716.08
7.1.20.0060.00616.02
7.1.10.0070.00715.92
7.1.00.0050.02919.15
7.0.330.0130.00015.45
7.0.320.0030.01015.47
7.0.310.0040.01215.58
7.0.300.0070.00715.56
7.0.290.0000.01315.67
7.0.280.0040.00715.42
7.0.270.0060.00315.42
7.0.260.0040.00815.58
7.0.250.0100.00315.64
7.0.240.0030.01015.51
7.0.230.0000.01415.36
7.0.220.0070.00715.40
7.0.210.0120.00315.60
7.0.200.0040.00516.19
7.0.190.0110.00315.30
7.0.180.0090.00415.54
7.0.170.0000.00815.51
7.0.160.0120.00015.43
7.0.150.0080.00315.27
7.0.140.0080.03518.84
7.0.130.0000.01015.34
7.0.120.0030.01415.53
7.0.110.0030.01015.52
7.0.100.0000.03617.70
7.0.90.0080.02317.86
7.0.80.0220.04317.79
7.0.70.0100.03817.80
7.0.60.0050.03317.85
7.0.50.0100.03518.10
7.0.40.0110.04216.77
7.0.30.0080.02416.94
7.0.20.0060.02616.87
7.0.10.0040.02616.91
7.0.00.0070.04216.80
5.6.400.0100.00714.48
5.6.390.0060.00914.42
5.6.380.0080.00814.63
5.6.370.0040.00414.43
5.6.360.0030.00714.48
5.6.350.0060.00614.63
5.6.340.0030.00914.92
5.6.330.0000.01714.94
5.6.320.0030.01314.79
5.6.310.0070.00714.48
5.6.300.0000.01314.59
5.6.290.0000.01214.30
5.6.280.0020.04318.07
5.6.270.0030.01214.45
5.6.260.0000.01014.52
5.6.250.0110.04117.69
5.6.240.0070.04617.71
5.6.230.0150.02417.53
5.6.220.0080.03517.67
5.6.210.0050.03117.63
5.6.200.0080.03317.83
5.6.190.0070.04617.87
5.6.180.0070.04817.85
5.6.170.0110.03518.06
5.6.160.0080.03617.90
5.6.150.0070.03317.88
5.6.140.0130.03017.89
5.6.130.0080.03917.92
5.6.120.0110.04017.76
5.6.110.0130.03517.78
5.6.100.0100.04317.84
5.6.90.0030.03017.80
5.6.80.0070.03417.39
5.6.70.0090.03817.43
5.6.60.0110.03517.52
5.6.50.0080.02417.56
5.6.40.0110.04017.32
5.6.30.0030.02917.57
5.6.20.0100.03017.62
5.6.10.0050.02917.65
5.6.00.0080.04317.34
5.5.380.0110.04317.50
5.5.370.0040.04917.60
5.5.360.0050.04717.58
5.5.350.0130.03317.63
5.5.340.0130.03817.70
5.5.330.0060.04417.81
5.5.320.0110.03617.77
5.5.310.0110.04017.76
5.5.300.0080.02517.84
5.5.290.0030.04317.70
5.5.280.0100.04317.89
5.5.270.0030.03217.70
5.5.260.0100.02517.61
5.5.250.0060.02617.57
5.5.240.0110.03817.54
5.5.230.0050.02617.47
5.5.220.0050.04417.34
5.5.210.0080.04317.27
5.5.200.0090.04517.24
5.5.190.0030.03217.39
5.5.180.0070.05217.30
5.5.170.0030.01014.29
5.5.160.0070.04417.33
5.5.150.0130.03217.31
5.5.140.0100.03517.33
5.5.130.0040.03717.36
5.5.120.0090.03917.52
5.5.110.0020.04917.31
5.5.100.0030.04717.33
5.5.90.0110.04017.38
5.5.80.0050.03817.21
5.5.70.0070.04217.23
5.5.60.0080.03517.19
5.5.50.0080.03817.27
5.5.40.0120.02517.25
5.5.30.0060.04517.42
5.5.20.0050.02717.35
5.5.10.0100.02917.14
5.5.00.0070.03817.31
5.4.450.0020.04215.34
5.4.440.0050.03715.54
5.4.430.0090.03215.29
5.4.420.0050.03015.52
5.4.410.0070.04915.27
5.4.400.0000.04115.26
5.4.390.0040.02515.09
5.4.380.0030.03815.26
5.4.370.0100.02815.21
5.4.360.0020.04815.21
5.4.350.0120.03615.27
5.4.340.0050.04315.26
5.4.330.0000.00811.29
5.4.320.0100.04315.21
5.4.310.0080.04115.09
5.4.300.0060.02315.23
5.4.290.0060.02315.25
5.4.280.0050.04315.09
5.4.270.0070.02615.30
5.4.260.0130.03515.31
5.4.250.0050.04315.10
5.4.240.0050.04015.29
5.4.230.0020.03015.08
5.4.220.0070.04514.95
5.4.210.0050.03515.32
5.4.200.0050.03315.25
5.4.190.0060.04014.99
5.4.180.0060.04115.15
5.4.170.0080.02115.23
5.4.160.0080.03715.07
5.4.150.0080.03814.98
5.4.140.0030.03513.80
5.4.130.0050.04013.89
5.4.120.0070.02413.88
5.4.110.0070.03913.99
5.4.100.0040.03913.82
5.4.90.0100.01714.00
5.4.80.0020.04313.80
5.4.70.0070.02713.87
5.4.60.0070.03013.90
5.4.50.0030.03014.01
5.4.40.0040.04213.79
5.4.30.0050.03213.79
5.4.20.0060.03813.88
5.4.10.0070.02813.97
5.4.00.0030.03913.63
5.3.290.0050.04212.70
5.3.280.0080.04212.64
5.3.270.0060.04012.59
5.3.260.0050.04012.79
5.3.250.0050.03412.78
5.3.240.0050.03512.75
5.3.230.0030.04412.72
5.3.220.0030.03412.69
5.3.210.0030.02212.66
5.3.200.0070.04012.50
5.3.190.0070.03712.70
5.3.180.0030.04012.56
5.3.170.0050.02412.73
5.3.160.0080.02812.82
5.3.150.0070.03712.80
5.3.140.0050.02312.59
5.3.130.0120.03512.71
5.3.120.0070.04112.63
5.3.110.0000.04612.63
5.3.100.0060.03312.34
5.3.90.0090.03312.39
5.3.80.0120.03212.39
5.3.70.0080.03912.32
5.3.60.0070.03912.34
5.3.50.0070.03712.34
5.3.40.0030.02512.37
5.3.30.0080.03512.34
5.3.20.0070.03712.35
5.3.10.0070.01912.08
5.3.00.0030.02211.96
5.2.170.0070.04711.28
5.2.160.0070.05311.32
5.2.150.0030.03011.29
5.2.140.0030.07011.28
5.2.130.0000.06311.23
5.2.120.0000.04011.23
5.2.110.0100.02311.26
5.2.100.0070.02711.25
5.2.90.0070.04711.26
5.2.80.0030.03311.25
5.2.70.0030.05011.36
5.2.60.0100.02311.22
5.2.50.0000.03011.20
5.2.40.0030.03011.21
5.2.30.0070.02311.05
5.2.20.0000.03710.99
5.2.10.0030.02711.13
5.2.00.0000.02710.89
5.1.60.0030.02310.48
5.1.50.0000.02710.48
5.1.40.0030.02710.48
5.1.30.0030.02710.48
5.1.20.0000.02310.53
5.1.10.0070.01710.48
5.1.00.0000.03010.48
5.0.50.0000.01710.48
5.0.40.0000.04710.48
5.0.30.0000.05010.48
5.0.20.0070.01310.48
5.0.10.0000.03710.48
5.0.00.0000.03010.48
4.4.90.0000.01710.48
4.4.80.0000.01710.48
4.4.70.0070.01010.48
4.4.60.0000.01710.48
4.4.50.0000.01710.48
4.4.40.0030.02310.48
4.4.30.0000.01710.48
4.4.20.0030.01310.48
4.4.10.0000.01710.48
4.4.00.0000.02710.48
4.3.110.0000.01710.48
4.3.100.0000.01710.48
4.3.90.0070.02010.48
4.3.80.0000.02310.48
4.3.70.0030.01710.48
4.3.60.0000.01710.48
4.3.50.0030.03010.48
4.3.40.0100.04310.48
4.3.30.0030.01710.48
4.3.20.0000.01710.48
4.3.10.0000.02010.48
4.3.00.0070.00710.48

preferences:
55.7 ms | 401 KiB | 5 Q