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->me->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.0070.00717.00
8.3.50.0100.01022.16
8.3.40.0180.00019.07
8.3.30.0100.00319.48
8.3.20.0050.00320.40
8.3.10.0040.00423.90
8.3.00.0080.00022.55
8.2.180.0070.01116.75
8.2.170.0070.00722.96
8.2.160.0140.00322.25
8.2.150.0060.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00422.36
8.2.110.0030.00722.32
8.2.100.0080.00418.08
8.2.90.0040.00419.52
8.2.80.0080.00017.97
8.2.70.0050.00317.88
8.2.60.0080.00017.75
8.2.50.0040.00418.10
8.2.40.0000.00821.32
8.2.30.0000.00818.39
8.2.20.0080.00017.93
8.2.10.0040.00417.95
8.2.00.0000.00817.97
8.1.280.0110.00425.92
8.1.270.0090.00023.96
8.1.260.0040.00426.35
8.1.250.0030.00628.09
8.1.240.0080.00422.18
8.1.230.0030.00919.67
8.1.220.0000.00918.04
8.1.210.0040.00418.77
8.1.200.0060.00317.47
8.1.190.0080.00017.78
8.1.180.0040.00418.10
8.1.170.0000.00918.91
8.1.160.0040.00422.24
8.1.150.0000.00818.87
8.1.140.0000.00717.74
8.1.130.0030.00318.09
8.1.120.0040.00417.75
8.1.110.0050.00317.71
8.1.100.0050.00217.69
8.1.90.0060.00317.55
8.1.80.0030.00317.78
8.1.70.0000.00817.57
8.1.60.0030.00617.84
8.1.50.0060.00317.64
8.1.40.0090.00017.68
8.1.30.0030.00517.89
8.1.20.0080.00017.79
8.1.10.0000.00817.83
8.1.00.0000.00817.58
8.0.300.0020.00518.77
8.0.290.0040.00417.00
8.0.280.0070.00018.68
8.0.270.0050.00317.36
8.0.260.0000.00717.17
8.0.250.0030.00317.16
8.0.240.0030.00317.26
8.0.230.0030.00417.30
8.0.220.0000.00717.07
8.0.210.0040.00417.05
8.0.200.0000.00617.21
8.0.190.0000.00817.25
8.0.180.0040.00417.13
8.0.170.0060.00317.10
8.0.160.0040.00417.18
8.0.150.0070.00017.14
8.0.140.0040.00417.03
8.0.130.0030.00313.59
8.0.120.0030.00517.21
8.0.110.0040.00417.27
8.0.100.0050.00317.00
8.0.90.0030.00517.04
8.0.80.0090.00617.29
8.0.70.0000.00717.17
8.0.60.0000.00717.00
8.0.50.0040.00417.00
8.0.30.0090.00917.58
8.0.20.0090.00917.40
8.0.10.0000.00817.23
8.0.00.0110.00817.06
7.4.330.0000.00515.22
7.4.320.0000.00616.84
7.4.300.0000.00716.83
7.4.290.0030.00316.83
7.4.280.0070.00016.92
7.4.270.0040.00416.70
7.4.260.0000.00716.83
7.4.250.0030.00516.75
7.4.240.0030.00316.77
7.4.230.0040.00416.82
7.4.220.0100.00716.67
7.4.210.0070.00816.73
7.4.200.0000.00716.79
7.4.190.0040.00416.64
7.4.160.0110.00616.59
7.4.150.0140.01017.40
7.4.140.0170.00517.86
7.4.130.0080.00816.69
7.4.120.0130.00516.68
7.4.110.0070.01216.61
7.4.100.0090.01216.98
7.4.90.0100.01316.85
7.4.80.0110.00816.64
7.4.70.0030.01316.75
7.4.60.0080.00816.87
7.4.50.0080.00016.64
7.4.40.0030.01422.77
7.4.30.0030.01216.79
7.4.00.0060.00915.02
7.3.330.0000.00513.57
7.3.320.0000.00513.35
7.3.310.0030.00316.48
7.3.300.0080.00016.62
7.3.290.0070.00716.58
7.3.280.0070.01116.58
7.3.270.0140.00417.40
7.3.260.0160.00316.84
7.3.250.0130.00516.65
7.3.240.0190.00316.80
7.3.230.0090.00916.61
7.3.210.0180.00716.62
7.3.200.0160.00319.39
7.3.190.0110.00516.88
7.3.180.0130.00316.79
7.3.170.0130.01016.58
7.3.160.0130.00316.60
7.3.120.0030.01414.94
7.2.330.0050.01416.63
7.2.320.0120.00916.90
7.2.310.0030.01316.89
7.2.300.0090.00917.00
7.2.290.0160.00616.80
7.2.00.0110.00419.63
7.1.200.0070.00716.02
7.1.100.0030.01018.32
7.1.70.0030.00517.11
7.1.60.0060.01919.29
7.1.50.0130.01917.06
7.1.00.0070.07322.50
7.0.200.0100.00316.97
7.0.140.0100.06722.09
7.0.60.0100.04320.02
7.0.50.0070.06718.05
7.0.40.0070.08320.47
7.0.30.0570.07020.17
7.0.20.0200.04320.30
7.0.10.0500.05320.31
7.0.00.0070.08320.32
5.6.210.0130.06320.89
5.6.200.0030.05018.32
5.6.190.0070.08720.86
5.6.180.0200.04020.45
5.6.170.0300.06020.68
5.6.160.0130.08320.57
5.6.150.0070.04018.29
5.6.140.0030.08018.25
5.6.130.0070.08318.35
5.6.120.0130.07721.04
5.6.110.0100.08021.02
5.6.100.0100.08721.21
5.6.90.0170.07721.03
5.6.80.0100.08020.39
5.6.70.4070.04320.43
5.5.350.0200.04720.45
5.5.340.0030.08718.03
5.5.330.0070.04020.39
5.5.320.0200.05320.61
5.5.310.0230.07320.38
5.5.300.0170.07318.16
5.5.290.0200.05318.11
5.5.280.0030.05320.86
5.5.270.0070.06020.73
5.5.260.0100.05320.95
5.5.250.0100.07320.67
5.5.240.0070.08320.32
5.4.450.3400.04019.66
5.4.440.3630.04719.47
5.4.430.3200.03319.66
5.4.420.3770.04019.55
5.4.410.3270.04019.54
5.4.400.3070.04019.05
5.4.390.4100.03719.02
5.4.380.3870.04719.13
5.4.370.4130.03719.32
5.4.360.3770.04319.07
5.4.350.4070.03719.09
5.4.340.3370.04319.21
5.4.320.3170.03319.30
5.4.310.3930.04019.05
5.4.300.3270.03319.12
5.4.290.3230.03719.02
5.4.280.3200.03719.07
5.4.270.3530.03719.29
5.4.260.3570.03719.38
5.4.250.3330.04319.16
5.4.240.3600.03719.20
5.4.230.3200.03319.32
5.4.220.3270.02719.02
5.4.210.3400.03719.06
5.4.200.3230.04019.13
5.4.190.3170.03719.19
5.4.180.2900.03719.29
5.4.170.3130.03319.29
5.4.160.3370.04019.03
5.4.150.3430.03319.13
5.4.140.3600.03316.61
5.4.130.3370.04016.65
5.4.120.3530.03016.60
5.4.110.3400.04016.54
5.4.100.3270.03716.68
5.4.90.3470.03316.51
5.4.80.3700.03716.52
5.4.70.3930.02716.52
5.4.60.3800.04016.64
5.4.50.3770.03016.66
5.4.40.4030.03716.51
5.4.30.4000.03716.67
5.4.20.3570.04016.48
5.4.10.3470.03716.63
5.4.00.3170.03315.92
5.3.290.3600.04314.89
5.3.280.3030.03314.77
5.3.270.3170.03714.78
5.3.260.3700.04014.82
5.3.250.3370.04014.69
5.3.240.3500.03014.72
5.3.230.3370.03714.83
5.3.220.3700.03714.78
5.3.210.4000.04714.82
5.3.200.3400.03314.63
5.3.190.3170.03314.63
5.3.180.3500.04314.64
5.3.170.3130.03714.63
5.3.160.3630.04014.63
5.3.150.4070.04014.62
5.3.140.4000.03714.62
5.3.130.4000.03714.80
5.3.120.3830.04014.62
5.3.110.3400.04014.77
5.3.100.3330.03314.21
5.3.90.3430.03014.26
5.3.80.3770.02714.20
5.3.70.3570.03014.28
5.3.60.3670.04014.06
5.3.50.4730.02314.15
5.3.40.3470.04314.02
5.3.30.3500.04013.96
5.3.20.3730.02713.78
5.3.10.3370.03713.71
5.3.00.4130.03013.73
5.2.170.3200.02011.32
5.2.160.3070.02311.40
5.2.150.2930.02311.25
5.2.140.2930.03011.24
5.2.130.2830.03711.37
5.2.120.3400.03011.35
5.2.110.2970.03311.15
5.2.100.3300.03311.15
5.2.90.2900.04311.38
5.2.80.2830.02011.19
5.2.70.3130.03011.21
5.2.60.2670.02711.05
5.2.50.2930.02711.23
5.2.40.2200.03011.01
5.2.30.2600.03010.96
5.2.20.2470.03011.05
5.2.10.2400.03011.02
5.2.00.2370.02711.03
5.1.60.2530.02710.20
5.1.50.2300.02310.31
5.1.40.2070.02010.00
5.1.30.2430.02310.40
5.1.20.2370.02710.36
5.1.10.2370.02710.27
5.1.00.2300.02710.15
5.0.50.1130.0239.29
5.0.40.1070.0209.29
5.0.30.1200.0279.29
5.0.20.1430.0209.29
5.0.10.1470.0239.29
5.0.00.1630.0339.29
4.4.90.1370.0209.29
4.4.80.1330.0179.29
4.4.70.1500.0109.29
4.4.60.1170.0179.29
4.4.50.1200.0179.29
4.4.40.0970.0309.29
4.4.30.1170.0139.29
4.4.20.1170.0139.29
4.4.10.1230.0179.29
4.4.00.1270.0279.29
4.3.110.1200.0209.29
4.3.100.1100.0139.29
4.3.90.1600.0139.29
4.3.80.1530.0279.29
4.3.70.1230.0139.29
4.3.60.1430.0179.29
4.3.50.1530.0209.29
4.3.40.1430.0279.29
4.3.30.0830.0239.29
4.3.20.0770.0179.29
4.3.10.0830.0239.29
4.3.00.0700.0209.29

preferences:
48.44 ms | 401 KiB | 5 Q