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; } return new self($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; } 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]; var_dump($simple->to->count());

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.0140.01018.68
8.3.50.0070.01222.11
8.3.40.0180.00419.27
8.3.30.0110.00718.96
8.3.20.0100.01019.07
8.3.10.0040.00421.05
8.3.00.0080.00023.96
8.2.180.0110.01118.79
8.2.170.0170.00322.96
8.2.160.0100.00320.64
8.2.150.0030.00624.18
8.2.140.0090.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00421.32
8.2.110.0090.00020.64
8.2.100.0070.00318.03
8.2.90.0030.00519.42
8.2.80.0000.00818.30
8.2.70.0050.00517.61
8.2.60.0040.00418.29
8.2.50.0080.00018.07
8.2.40.0000.00918.41
8.2.30.0040.00421.39
8.2.20.0000.00717.93
8.2.10.0000.00817.94
8.2.00.0040.00417.86
8.1.280.0090.00925.92
8.1.270.0000.00823.99
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0040.00722.70
8.1.230.0060.00621.09
8.1.220.0000.00818.77
8.1.210.0030.00619.26
8.1.200.0030.00617.47
8.1.190.0030.00617.78
8.1.180.0040.00418.10
8.1.170.0040.00418.72
8.1.160.0070.00019.06
8.1.150.0030.00518.88
8.1.140.0050.00317.65
8.1.130.0030.00318.05
8.1.120.0070.00017.76
8.1.110.0050.00317.54
8.1.100.0040.00417.60
8.1.90.0000.00717.57
8.1.80.0040.00417.62
8.1.70.0040.00417.71
8.1.60.0000.00917.73
8.1.50.0040.00417.77
8.1.40.0030.00617.66
8.1.30.0000.00817.92
8.1.20.0030.00517.82
8.1.10.0040.00417.87
8.1.00.0040.00417.84
8.0.300.0080.00020.02
8.0.290.0070.00017.29
8.0.280.0030.00318.67
8.0.270.0030.00317.50
8.0.260.0060.00017.09
8.0.250.0040.00417.31
8.0.240.0000.00817.17
8.0.230.0000.00717.25
8.0.220.0060.00317.13
8.0.210.0030.00317.02
8.0.200.0060.00017.23
8.0.190.0040.00417.24
8.0.180.0040.00417.06
8.0.170.0040.00417.06
8.0.160.0040.00417.25
8.0.150.0040.00417.16
8.0.140.0000.00717.21
8.0.130.0050.00013.52
8.0.120.0040.00417.20
8.0.110.0040.00417.18
8.0.100.0040.00417.05
8.0.90.0040.00417.10
8.0.80.0120.00317.05
8.0.70.0050.00217.00
8.0.60.0000.00817.14
8.0.50.0080.00017.22
8.0.30.0110.01017.41
8.0.20.0140.00517.50
8.0.10.0000.00717.32
8.0.00.0140.00717.02
7.4.330.0030.00315.03
7.4.320.0070.00016.84
7.4.300.0060.00016.61
7.4.290.0040.00416.68
7.4.280.0040.00416.79
7.4.270.0030.00316.90
7.4.260.0030.00313.48
7.4.250.0000.00716.67
7.4.240.0040.00416.75
7.4.230.0030.00316.59
7.4.220.0070.01416.71
7.4.210.0080.00916.80
7.4.200.0000.00716.85
7.4.190.0030.00316.91
7.4.160.0090.00616.74
7.4.150.0170.00317.40
7.4.140.0130.00817.86
7.4.130.0050.01416.69
7.4.120.0070.01116.75
7.4.110.0080.00916.50
7.4.100.0060.01216.64
7.4.90.0110.00716.69
7.4.80.0120.00919.39
7.4.70.0070.01016.75
7.4.60.0110.00616.76
7.4.50.0060.00316.71
7.4.40.0100.00322.52
7.4.30.0100.00616.75
7.4.00.0090.00714.97
7.3.330.0000.00613.61
7.3.320.0000.00613.50
7.3.310.0040.00416.47
7.3.300.0030.00316.59
7.3.290.0110.00816.55
7.3.280.0030.01316.60
7.3.270.0090.00917.40
7.3.260.0090.01418.24
7.3.250.0100.01016.55
7.3.240.0120.00616.63
7.3.230.0070.01116.85
7.3.210.0180.01116.89
7.3.200.0110.01519.39
7.3.190.0110.01116.57
7.3.180.0100.00716.71
7.3.170.0090.01216.54
7.3.160.0040.01216.76
7.3.120.0050.01015.09
7.3.110.0130.00615.00
7.3.100.0040.00914.81
7.3.90.0060.00315.00
7.3.80.0080.00415.19
7.3.70.0030.00614.93
7.3.60.0090.00615.03
7.3.50.0060.00914.96
7.3.40.0060.00614.91
7.3.30.0070.00714.81
7.3.20.0100.00016.65
7.3.10.0030.01116.83
7.3.00.0060.00616.81
7.2.330.0070.01017.04
7.2.320.0060.01716.76
7.2.310.0140.00316.89
7.2.300.0090.00616.95
7.2.290.0070.01416.95
7.2.250.0100.00715.05
7.2.240.0030.01415.04
7.2.230.0030.01315.45
7.2.220.0030.00715.52
7.2.210.0080.00415.35
7.2.200.0000.01315.26
7.2.190.0060.00915.33
7.2.180.0060.00615.07
7.2.170.0080.00915.19
7.2.130.0120.00317.26
7.2.120.0040.01116.93
7.2.110.0070.00717.02
7.2.100.0030.00717.16
7.2.90.0140.00016.96
7.2.80.0080.00417.21
7.2.70.0040.01116.97
7.2.60.0090.00317.15
7.2.50.0090.00616.85
7.2.40.0090.00616.78
7.2.30.0030.01217.21
7.2.20.0030.01016.94
7.2.10.0150.00416.92
7.2.00.0030.01218.30
7.1.330.0030.01316.01
7.1.320.0070.00715.95
7.1.310.0090.00615.79
7.1.300.0000.00916.01
7.1.290.0000.00915.75
7.1.280.0030.00715.90
7.1.270.0050.00515.66
7.1.260.0040.01115.59
7.1.250.0090.00315.86
7.1.100.0060.00918.12
7.1.70.0070.00317.24
7.1.60.0110.01519.40
7.1.50.0110.00734.93
7.1.00.0030.06722.44
7.0.200.0000.00816.92
7.0.140.0070.07022.04
7.0.60.0130.07319.91
7.0.50.0030.06317.96
7.0.40.0100.04020.48
7.0.30.0270.05320.23
7.0.20.0200.08320.20
7.0.10.0230.06320.18
7.0.00.0030.06320.37
5.6.280.0070.07021.19
5.6.210.0070.08320.52
5.6.200.0000.04718.36
5.6.190.0130.07720.47
5.6.180.0300.07320.41
5.6.170.0070.04720.63
5.6.160.0100.08020.54
5.6.150.0070.08718.25
5.6.140.0070.08018.28
5.6.130.0100.08318.27
5.6.120.0070.09020.97
5.6.110.0070.08321.21
5.6.100.0070.08021.17
5.6.90.0000.05321.00
5.6.80.0100.05720.41
5.6.70.4430.04320.43
5.5.350.0170.08020.48
5.5.340.0030.04318.03
5.5.330.0070.03720.35
5.5.320.0200.05720.65
5.5.310.0300.07020.46
5.5.300.0130.03718.21
5.5.290.0130.07018.12
5.5.280.0200.07021.03
5.5.270.0030.09021.03
5.5.260.0170.06320.95
5.5.250.0070.05720.91
5.5.240.0100.08320.41
5.4.450.0030.08319.41
5.4.440.0030.06719.42
5.4.430.0000.04719.68
5.4.420.0100.07019.48
5.4.410.0030.07019.25
5.4.400.0130.05019.07
5.4.390.0070.07319.04
5.4.380.0030.07719.04
5.4.370.0030.06719.07
5.4.360.0070.07019.33
5.4.350.0030.06719.21
5.4.340.0030.05719.32
5.4.320.0030.07719.30
5.4.310.0030.05019.07
5.4.300.0000.05319.05
5.4.290.0030.08019.38
5.4.280.0000.06319.13
5.4.270.0030.04319.05
5.4.260.0100.07319.29
5.4.250.0070.06719.07
5.4.240.0000.08319.16
5.4.230.0030.06319.29
5.4.220.0100.06319.13
5.4.210.0000.07719.13
5.4.200.0030.04319.06
5.4.190.0070.07319.12
5.4.180.0070.07019.01
5.4.170.0130.06719.30
5.4.160.0000.05019.00
5.4.150.0000.05319.00
5.4.140.0070.06716.63
5.4.130.0000.07316.46
5.4.120.0100.04316.63
5.4.110.0000.07716.66
5.4.100.0030.07316.65
5.4.90.0000.06016.58
5.4.80.0000.04016.64
5.4.70.0000.03716.40
5.4.60.0230.02716.64
5.4.50.0000.04016.37
5.4.40.0030.03716.70
5.4.30.0000.03316.37
5.4.20.0030.03016.66
5.4.10.0000.03716.55
5.4.00.0000.03316.02
5.3.290.0030.04714.88
5.3.280.0030.04714.81
5.3.270.0070.06714.92
5.3.260.0000.07714.88
5.3.250.0000.05314.68
5.3.240.0030.05014.68
5.3.230.0030.05714.91
5.3.220.0000.04314.84
5.3.210.0030.04714.82
5.3.200.0000.08014.63
5.3.190.0070.07314.79
5.3.180.0000.05314.63
5.3.170.0070.07014.64
5.3.160.0000.04314.83
5.3.150.0000.03714.66
5.3.140.0000.04014.73
5.3.130.0100.03714.81
5.3.120.0000.04014.61
5.3.110.0030.03714.66
5.3.100.0000.03714.09
5.3.90.0030.03314.18
5.3.80.0070.03014.02
5.3.70.0030.03014.28
5.3.60.0000.05714.10
5.3.50.0030.03314.05
5.3.40.0030.04014.22
5.3.30.0000.03714.01
5.3.20.0030.07013.91
5.3.10.0070.03313.78
5.3.00.0000.04013.69
5.2.170.0000.03013.20
5.2.160.0000.03313.20
5.2.150.0030.02713.20
5.2.140.0030.02713.20
5.2.130.0030.03013.20
5.2.120.0000.03013.20
5.2.110.0070.02013.20
5.2.100.0000.03013.20
5.2.90.0000.03313.20
5.2.80.0000.03013.20
5.2.70.0000.03013.20
5.2.60.0000.03013.20
5.2.50.0000.03013.20
5.2.40.0000.02713.20
5.2.30.0000.03313.20
5.2.20.0030.02713.20
5.2.10.0000.03313.20
5.2.00.0000.06313.20
5.1.60.0000.02713.20
5.1.50.0000.02713.20
5.1.40.0000.02313.20
5.1.30.0030.02313.20
5.1.20.0000.03313.20
5.1.10.0000.02713.20
5.1.00.0030.02313.20
5.0.50.0000.02313.20
5.0.40.0000.04313.20
5.0.30.0000.03713.20
5.0.20.0030.02013.20
5.0.10.0000.02013.20
5.0.00.0030.03013.20
4.4.90.0000.02313.20
4.4.80.0000.01313.20
4.4.70.0000.01313.20
4.4.60.0030.01313.20
4.4.50.0030.01713.20
4.4.40.0000.02713.20
4.4.30.0000.01313.20
4.4.20.0000.01713.20
4.4.10.0000.01713.20
4.4.00.0000.02313.20
4.3.110.0000.01713.20
4.3.100.0000.01313.20
4.3.90.0000.01313.20
4.3.80.0000.05013.20
4.3.70.0070.03013.20
4.3.60.0070.02013.20
4.3.50.0030.02313.20
4.3.40.0030.05313.20
4.3.30.0000.02013.20
4.3.20.0030.03713.20
4.3.10.0070.03013.20
4.3.00.0070.02713.20

preferences:
76.12 ms | 401 KiB | 5 Q