3v4l.org

run code in 300+ PHP versions simultaneously
<?php class XmlArrayAccessIterator implements ArrayAccess, IteratorAggregate { private $xml; private $current = 1; public function __construct($filePath, $isUrl = true) { $this->isUrl = $isUrl; $this->xml = new SimpleXmlIterator($filePath, 0, $isUrl); $this->current = $this->xml; } public function offsetExists($offset) { return !is_null($this->xml->$offset); } public function offsetGet($offset) { if ($this->xml->getName() == $offset) { return $this; } //$this->current = $this->xml->$offset; return new self($this->xml->$offset->asXML(), false); } public function __toString() { return (string) $this->current; } 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']; 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.0070.01417.13
8.3.50.0090.00617.66
8.3.40.0150.00019.09
8.3.30.0090.00919.04
8.3.20.0080.00018.98
8.3.10.0030.00620.90
8.3.00.0040.00419.63
8.2.180.0100.01018.66
8.2.170.0110.00422.96
8.2.160.0100.00320.64
8.2.150.0090.00024.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0080.00020.98
8.2.110.0040.00721.25
8.2.100.0000.01218.28
8.2.90.0030.00919.78
8.2.80.0080.00019.53
8.2.70.0040.00417.88
8.2.60.0060.00318.05
8.2.50.0030.00618.07
8.2.40.0030.00618.53
8.2.30.0000.00818.46
8.2.20.0040.00418.00
8.2.10.0030.00518.09
8.2.00.0040.00418.11
8.1.280.0130.00625.92
8.1.270.0090.00624.66
8.1.260.0000.00926.35
8.1.250.0050.00328.09
8.1.240.0090.00322.79
8.1.230.0060.00621.27
8.1.220.0060.00318.16
8.1.210.0040.00419.34
8.1.200.0100.00017.73
8.1.190.0040.00417.89
8.1.180.0040.00418.10
8.1.170.0080.00019.25
8.1.160.0040.00419.19
8.1.150.0060.00318.89
8.1.140.0040.00417.74
8.1.130.0040.00418.13
8.1.120.0040.00417.79
8.1.110.0090.00017.78
8.1.100.0000.00717.67
8.1.90.0030.00617.67
8.1.80.0020.00517.75
8.1.70.0000.00717.73
8.1.60.0000.00817.86
8.1.50.0040.00417.75
8.1.40.0030.00617.72
8.1.30.0030.00517.84
8.1.20.0000.00818.02
8.1.10.0030.00617.77
8.1.00.0040.00417.75
8.0.300.0000.00720.14
8.0.290.0070.00017.13
8.0.280.0000.00718.73
8.0.270.0070.00017.48
8.0.260.0000.00717.01
8.0.250.0030.00517.33
8.0.240.0000.00717.21
8.0.230.0070.00017.26
8.0.220.0030.00517.30
8.0.210.0030.00517.25
8.0.200.0000.00717.31
8.0.190.0040.00417.37
8.0.180.0000.00717.17
8.0.170.0060.00317.17
8.0.160.0030.00517.18
8.0.150.0000.00917.22
8.0.140.0040.00417.12
8.0.130.0030.00313.70
8.0.120.0060.00317.18
8.0.110.0050.00317.05
8.0.100.0030.00517.10
8.0.90.0000.00717.14
8.0.80.0100.00717.24
8.0.70.0050.00317.14
8.0.60.0070.00017.27
8.0.50.0040.00417.12
8.0.30.0130.00717.45
8.0.20.0130.00617.47
8.0.10.0090.00017.32
8.0.00.0130.00817.16
7.4.330.0000.00513.39
7.4.320.0000.00616.80
7.4.300.0030.00616.93
7.4.290.0000.00716.84
7.4.280.0060.00316.89
7.4.270.0040.00416.75
7.4.260.0060.00013.68
7.4.250.0040.00416.80
7.4.240.0080.00016.73
7.4.230.0000.00816.57
7.4.220.0070.01416.80
7.4.210.0090.00516.75
7.4.200.0040.00416.75
7.4.190.0070.00016.70
7.4.160.0160.00016.95
7.4.150.0070.01016.74
7.4.140.0110.00616.85
7.4.130.0080.00916.80
7.4.120.0090.00816.74
7.4.110.0070.01016.71
7.4.100.0120.00616.80
7.4.90.0070.01116.84
7.4.80.0130.01019.39
7.4.70.0120.00616.96
7.4.60.0140.00316.73
7.4.50.0050.00716.68
7.4.40.0120.00316.70
7.4.30.0030.01316.97
7.4.00.0070.01015.11
7.3.330.0000.00713.69
7.3.320.0030.00313.72
7.3.310.0050.00216.54
7.3.300.0050.00216.73
7.3.290.0160.00816.77
7.3.280.0060.01216.69
7.3.270.0100.00816.73
7.3.260.0100.00716.88
7.3.250.0110.00716.69
7.3.240.0070.01016.68
7.3.230.0080.00816.94
7.3.210.0000.01616.73
7.3.200.0120.00916.73
7.3.190.0040.01516.82
7.3.180.0100.01016.90
7.3.170.0090.00616.82
7.3.160.0150.00416.95
7.3.120.0100.00715.03
7.3.10.0070.00716.75
7.3.00.0040.01116.96
7.2.330.0080.01216.91
7.2.320.0160.00916.71
7.2.310.0130.00616.93
7.2.300.0130.00416.70
7.2.290.0070.01016.71
7.2.130.0030.00617.11
7.2.120.0030.01017.14
7.2.110.0080.01016.91
7.2.100.0080.00316.91
7.2.90.0060.00917.20
7.2.80.0070.00717.15
7.2.70.0000.01317.43
7.2.60.0060.00717.13
7.2.50.0100.00717.22
7.2.40.0060.00916.92
7.2.30.0060.01017.11
7.2.20.0070.00716.84
7.2.10.0040.00717.15
7.2.00.0060.00618.41
7.1.250.0070.00715.69
7.1.200.0200.00415.53
7.1.100.0040.00818.19
7.1.70.0060.01017.11
7.1.60.0060.01219.40
7.1.50.0060.00616.98
7.1.00.0070.04322.59
7.0.200.0180.00716.70
7.0.140.0070.08322.16
7.0.120.0070.05722.26
7.0.60.0070.08020.01
7.0.50.0170.07018.03
7.0.40.0130.08320.27
7.0.30.0030.08720.23
7.0.20.0170.07020.40
7.0.10.0100.04020.19
7.0.00.0030.04320.23
5.6.280.0030.07721.06
5.6.210.0030.08720.65
5.6.200.0130.04018.27
5.6.190.0130.05720.59
5.6.180.0100.09020.79
5.6.170.0000.06320.56
5.6.160.0070.05020.52
5.6.150.0000.05720.39
5.6.140.0130.07320.27
5.6.130.0170.05020.64
5.6.120.0070.07720.61
5.6.110.0030.05020.48
5.6.100.0000.05020.54
5.6.90.0100.06720.40
5.6.80.0030.08319.99
5.6.70.0030.08019.83
5.6.60.0000.05019.93
5.6.50.0070.06719.94
5.6.40.0170.07019.69
5.6.30.0130.07720.01
5.6.20.0000.08719.77
5.6.10.0170.07019.68
5.6.00.0100.08019.91
5.5.350.0270.08320.66
5.5.340.0030.08718.14
5.5.330.0030.08720.36
5.5.320.0100.07320.62
5.5.310.0070.07020.55
5.5.300.0030.04320.08
5.5.290.0030.05720.45
5.5.280.0070.08320.30
5.5.270.0030.05320.25
5.5.260.0130.04020.11
5.5.250.0070.08020.16
5.5.240.0100.06719.64
5.5.230.0100.07719.63
5.5.220.0030.07019.83
5.5.210.0070.03719.82
5.5.200.0200.06019.70
5.5.190.0100.08019.77
5.5.180.0130.06719.70
5.5.160.0100.07319.61
5.5.150.0070.08319.84
5.5.140.0100.07019.47
5.5.130.0100.06019.40
5.5.120.0070.08319.69
5.5.110.0070.04019.79
5.5.100.0030.08319.38
5.5.90.0100.08019.33
5.5.80.0130.07319.56
5.5.70.0070.07719.46
5.5.60.0070.07019.65
5.5.50.0100.04019.30
5.5.40.0070.08019.46
5.5.30.0130.07019.41
5.5.20.0100.05319.46
5.5.10.0100.06019.49
5.5.00.0100.07719.59
5.4.450.0030.05719.50
5.4.440.0100.08019.50
5.4.430.0070.07719.46
5.4.420.0130.06319.49
5.4.410.0130.07019.14
5.4.400.0070.07719.21
5.4.390.0070.07719.40
5.4.380.0070.03719.46
5.4.370.0030.04019.21
5.4.360.0100.07719.29
5.4.350.0030.05319.46
5.4.340.0030.06319.39
5.4.320.0130.05718.98
5.4.310.0070.08019.30
5.4.300.0030.07719.39
5.4.290.0000.06319.17
5.4.280.0070.07019.39
5.4.270.0070.03718.93
5.4.260.0070.07019.30
5.4.250.0130.06018.94
5.4.240.0030.07719.20
5.4.230.0070.05719.20
5.4.220.0100.07719.39
5.4.210.0070.04019.13
5.4.200.0030.06719.08
5.4.190.0030.07319.15
5.4.180.0070.04319.16
5.4.170.0070.08019.38
5.4.160.0030.06319.28
5.4.150.0070.07319.43
5.4.140.0100.05016.54
5.4.130.0070.07716.63
5.4.120.0070.05316.61
5.4.110.0100.07016.57
5.4.100.0130.03716.58
5.4.90.0000.04316.44
5.4.80.0170.06316.64
5.4.70.0000.07716.46
5.4.60.0070.07016.53
5.4.50.0070.07016.45
5.4.40.0070.06316.54
5.4.30.0030.07716.54
5.4.20.0070.06016.45
5.4.10.0030.08016.50
5.4.00.0030.04315.98
5.3.290.0070.07714.86
5.3.280.0030.08014.86
5.3.270.0070.07314.79
5.3.260.0030.04314.82
5.3.250.0030.08314.79
5.3.240.0070.08314.77
5.3.230.0070.06714.72
5.3.220.0070.05714.75
5.3.210.0030.07014.60
5.3.200.0070.06314.78
5.3.190.0070.07714.75
5.3.180.0000.06314.68
5.3.170.0100.07314.75
5.3.160.0030.07014.74
5.3.150.0070.07014.75
5.3.140.0070.07314.75
5.3.130.0130.07014.71
5.3.120.0030.06314.81
5.3.110.0000.06714.68
5.3.100.0000.05714.18
5.3.90.0100.03014.20
5.3.80.0100.03014.20
5.3.70.0100.03014.21
5.3.60.0000.04014.07
5.3.50.0070.03314.02
5.3.40.0000.04014.16
5.3.30.0070.03014.10
5.3.20.0130.02713.88
5.3.10.0000.03713.87
5.3.00.0000.03713.77
5.2.170.0000.03311.41
5.2.160.0030.02711.34
5.2.150.0000.03011.29
5.2.140.0000.03011.20
5.2.130.0070.03011.27
5.2.120.0030.02711.32
5.2.110.0030.02711.30
5.2.100.0000.03711.16
5.2.90.0070.02311.32
5.2.80.0000.03011.12
5.2.70.0230.02011.21
5.2.60.0000.03011.24
5.2.50.0030.02711.05
5.2.40.0000.03011.13
5.2.30.0000.03011.14
5.2.20.0000.03011.14
5.2.10.0030.02711.02
5.2.00.0000.03010.88
5.1.60.0000.02710.19
5.1.50.0030.02310.18
5.1.40.0000.02710.14
5.1.30.0000.02710.50
5.1.20.0000.02710.49
5.1.10.0000.02710.11
5.1.00.0000.02710.04
5.0.50.0030.0178.54
5.0.40.0000.0208.45
5.0.30.0000.0308.15
5.0.20.0000.0238.22
5.0.10.0000.0208.25
5.0.00.0030.0278.18
4.4.90.0000.0136.25
4.4.80.0000.0176.25
4.4.70.0030.0136.25
4.4.60.0030.0136.25
4.4.50.0000.0136.25
4.4.40.0000.0236.25
4.4.30.0030.0136.25
4.4.20.0030.0136.25
4.4.10.0070.0136.25
4.4.00.0000.0236.25
4.3.110.0000.0136.25
4.3.100.0000.0136.25
4.3.90.0000.0136.25
4.3.80.0000.0276.25
4.3.70.0000.0136.25
4.3.60.0000.0176.25
4.3.50.0000.0136.25
4.3.40.0000.0236.25
4.3.30.0000.0136.25
4.3.20.0030.0136.25
4.3.10.0030.0136.25
4.3.00.0000.0136.25

preferences:
42.67 ms | 401 KiB | 5 Q