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); } 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 $this->current = new self($this->xml->$offset->asXML(), false); } public function __toString() { var_dump($this->current); 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']; //var_dump((string)$xml['note']['recursive']);

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.0130.00718.80
8.3.50.0100.01022.10
8.3.40.0150.00019.03
8.3.30.0120.00319.25
8.3.20.0070.00020.62
8.3.10.0060.00322.17
8.3.00.0080.00022.40
8.2.180.0090.01217.13
8.2.170.0110.00422.96
8.2.160.0140.00021.23
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00419.61
8.2.110.0040.00721.25
8.2.100.0040.00818.16
8.2.90.0000.00819.61
8.2.80.0080.00017.97
8.2.70.0040.00417.88
8.2.60.0040.00418.15
8.2.50.0030.00618.07
8.2.40.0040.00418.59
8.2.30.0040.00418.38
8.2.20.0030.00518.00
8.2.10.0030.00519.83
8.2.00.0040.00417.89
8.1.280.0140.00425.92
8.1.270.0040.00422.32
8.1.260.0030.00526.35
8.1.250.0030.00628.09
8.1.240.0090.00020.98
8.1.230.0000.01121.07
8.1.220.0030.00518.04
8.1.210.0060.00318.77
8.1.200.0060.00317.60
8.1.190.0000.00817.66
8.1.180.0040.00418.98
8.1.170.0080.00018.88
8.1.160.0000.00822.24
8.1.150.0000.00818.91
8.1.140.0030.00617.77
8.1.130.0030.00317.98
8.1.120.0080.00017.63
8.1.110.0070.00317.74
8.1.100.0080.00017.75
8.1.90.0000.00717.71
8.1.80.0000.00717.71
8.1.70.0040.00417.75
8.1.60.0000.00917.79
8.1.50.0040.00417.69
8.1.40.0030.00517.81
8.1.30.0040.00417.88
8.1.20.0030.00617.88
8.1.10.0040.00417.81
8.1.00.0000.00817.82
8.0.300.0000.00718.77
8.0.290.0000.00717.29
8.0.280.0000.00718.76
8.0.270.0040.00417.54
8.0.260.0030.00317.09
8.0.250.0020.00517.11
8.0.240.0050.00317.19
8.0.230.0000.00717.18
8.0.220.0030.00317.26
8.0.210.0080.00017.14
8.0.200.0030.00317.21
8.0.190.0030.00317.24
8.0.180.0000.00817.13
8.0.170.0000.00717.15
8.0.160.0040.00416.98
8.0.150.0000.00717.23
8.0.140.0040.00417.01
8.0.130.0000.00613.48
8.0.120.0050.00317.04
8.0.110.0030.00517.12
8.0.100.0050.00217.00
8.0.90.0040.00417.05
8.0.80.0000.01617.10
8.0.70.0040.00417.04
8.0.60.0000.00717.17
8.0.50.0080.00017.21
8.0.30.0150.00517.33
8.0.20.0120.01117.40
8.0.10.0000.00817.30
8.0.00.0070.01116.99
7.4.330.0020.00215.43
7.4.320.0040.00416.84
7.4.300.0000.00716.80
7.4.290.0040.00416.79
7.4.280.0050.00316.78
7.4.270.0000.00816.75
7.4.260.0030.00316.79
7.4.250.0060.00316.64
7.4.240.0020.00516.78
7.4.230.0000.00716.56
7.4.220.0100.00716.74
7.4.210.0100.00716.78
7.4.200.0000.00716.95
7.4.190.0020.00516.89
7.4.160.0100.00716.77
7.4.150.0090.00917.40
7.4.140.0070.01117.86
7.4.130.0080.01416.84
7.4.120.0170.00216.99
7.4.110.0090.00916.83
7.4.100.0160.00316.77
7.4.90.0210.00316.82
7.4.80.0110.00619.39
7.4.70.0170.00016.93
7.4.60.0190.00316.54
7.4.50.0090.00016.63
7.4.40.0070.01122.77
7.4.30.0080.00816.70
7.4.10.0060.01315.00
7.4.00.0060.01215.02
7.3.330.0000.00613.46
7.3.320.0030.00313.64
7.3.310.0040.00416.68
7.3.300.0050.00316.65
7.3.290.0070.00716.69
7.3.280.0100.00716.67
7.3.270.0030.01317.40
7.3.260.0170.00416.69
7.3.250.0100.00916.72
7.3.240.0090.01216.83
7.3.230.0100.01416.70
7.3.210.0100.00716.79
7.3.200.0130.01019.39
7.3.190.0070.01016.76
7.3.180.0100.00716.58
7.3.170.0090.01016.73
7.3.160.0030.01316.94
7.3.130.0060.01315.03
7.3.120.0070.00915.03
7.3.110.0090.01015.05
7.3.100.0070.00915.05
7.3.90.0040.01115.04
7.3.80.0070.00615.10
7.3.70.0030.00914.99
7.3.60.0060.00814.78
7.3.50.0020.01214.88
7.3.40.0060.01014.99
7.3.30.0070.00714.91
7.3.20.0070.00716.85
7.3.10.0020.01116.88
7.3.00.0060.00916.72
7.2.330.0030.01516.88
7.2.320.0140.01116.95
7.2.310.0080.00916.89
7.2.300.0120.00616.84
7.2.290.0060.01617.05
7.2.260.0060.01315.52
7.2.250.0100.00915.37
7.2.240.0040.01315.30
7.2.230.0100.00815.34
7.2.220.0060.00915.31
7.2.210.0070.00615.18
7.2.200.0030.01215.27
7.2.190.0060.00915.18
7.2.180.0070.00715.03
7.2.170.0080.00715.24
7.2.160.0080.00515.08
7.2.150.0060.00716.94
7.2.140.0070.00817.04
7.2.130.0050.01117.23
7.2.120.0040.01017.15
7.2.110.0050.00917.08
7.2.100.0060.00617.07
7.2.90.0060.00817.01
7.2.80.0030.01217.19
7.2.70.0060.00916.89
7.2.60.0070.00717.21
7.2.50.0080.00517.08
7.2.40.0030.01017.32
7.2.30.0020.01117.01
7.2.20.0070.00617.14
7.2.10.0050.01217.12
7.2.00.0090.00517.08
7.1.330.0080.00915.90
7.1.320.0060.00815.83
7.1.310.0040.00815.95
7.1.300.0060.01015.82
7.1.290.0060.00915.89
7.1.280.0050.00916.02
7.1.270.0070.00715.73
7.1.260.0030.01115.90
7.1.250.0070.00915.80
7.1.240.0090.00615.91
7.1.230.0030.01015.81
7.1.220.0060.00715.93
7.1.210.0080.00515.84
7.1.200.0040.00915.97
7.1.190.0050.01016.05
7.1.180.0060.00615.85
7.1.170.0030.01015.79
7.1.160.0040.00915.75
7.1.150.0060.00815.91
7.1.140.0040.00815.88
7.1.130.0070.00815.73
7.1.120.0030.00915.92
7.1.110.0050.00815.96
7.1.100.0070.00816.76
7.1.90.0050.00815.81
7.1.80.0070.00515.95
7.1.70.0060.00716.42
7.1.60.0060.00917.30
7.1.50.0080.00816.34
7.1.40.0030.01115.94
7.1.30.0080.00715.86
7.1.20.0060.00815.93
7.1.10.0090.00515.84
7.1.00.0050.03118.09
7.0.330.0080.00315.47
7.0.320.0060.00515.52
7.0.310.0120.00215.64
7.0.300.0090.00415.58
7.0.290.0110.00215.56
7.0.280.0020.01015.62
7.0.270.0050.00815.50
7.0.260.0050.00515.36
7.0.250.0050.01015.48
7.0.240.0080.00615.51
7.0.230.0050.00915.63
7.0.220.0090.00415.49
7.0.210.0050.00915.57
7.0.200.0070.00416.08
7.0.190.0030.01015.64
7.0.180.0030.00815.62
7.0.170.0020.01015.61
7.0.160.0040.01115.59
7.0.150.0070.00715.54
7.0.140.0070.02917.83
7.0.130.0020.00815.53
7.0.120.0100.00315.75
7.0.110.0040.01215.41
7.0.100.0020.00715.51
7.0.90.0100.00215.46
7.0.80.0080.00815.57
7.0.70.0050.00715.30
7.0.60.0050.03017.09
7.0.50.0050.02016.42
7.0.40.0030.02015.79
7.0.30.0110.01515.76
7.0.20.0140.03215.76
7.0.10.0050.03615.77
7.0.00.0030.03615.75
5.6.400.0070.00914.65
5.6.390.0030.00914.60
5.6.380.0070.00714.80
5.6.370.0050.00914.56
5.6.360.0100.00314.41
5.6.350.0070.00714.67
5.6.340.0080.00714.61
5.6.330.0080.00914.56
5.6.320.0070.00814.57
5.6.310.0080.01014.46
5.6.300.0000.01214.61
5.6.290.0050.00814.56
5.6.280.0040.03116.68
5.6.270.0090.00714.51
5.6.260.0000.01514.50
5.6.250.0010.01314.43
5.6.240.0060.00814.54
5.6.230.0070.00814.61
5.6.220.0050.00814.65
5.6.210.0110.02816.69
5.6.200.0090.02715.71
5.6.190.0020.03216.82
5.6.180.0100.03516.74
5.6.170.0100.01616.60
5.6.160.0030.02016.52
5.6.150.0090.02515.82
5.6.140.0080.03215.97
5.6.130.0030.03215.80
5.6.120.0070.01716.83
5.6.110.0070.02916.63
5.6.100.0060.01816.64
5.6.90.0060.02216.65
5.6.80.0060.02516.48
5.6.70.0070.00214.49
5.6.60.0070.00814.64
5.6.50.0080.00314.57
5.6.40.0050.00514.68
5.6.30.0030.01114.51
5.6.20.0060.00814.45
5.6.10.0040.00814.41
5.6.00.0030.00914.44
5.5.380.0090.00314.61
5.5.370.0050.00814.41
5.5.360.0090.00514.58
5.5.350.0040.03416.47
5.5.340.0030.02015.65
5.5.330.0040.02116.58
5.5.320.0120.02016.46
5.5.310.0130.02516.51
5.5.300.0080.03115.76
5.5.290.0060.02115.78
5.5.280.0060.01816.74
5.5.270.0100.02916.62
5.5.260.0060.02816.63
5.5.250.0080.01616.56
5.5.240.0180.02916.44
5.5.230.0060.00414.35
5.5.220.0040.01014.50
5.5.210.0080.00314.34
5.5.200.0040.00814.25
5.5.190.0010.01314.47
5.5.180.0060.00614.44
5.5.170.0030.01214.48
5.5.160.0030.01014.68
5.5.150.0060.00814.52
5.5.140.0060.00814.48
5.5.130.0050.01014.59
5.5.120.0040.00614.55
5.5.110.0130.00214.44
5.5.100.0070.00514.43
5.5.90.0070.00714.42
5.5.80.0030.01314.60
5.5.70.0090.00514.51
5.5.60.0060.00714.25
5.5.50.0090.00414.45
5.5.40.0050.00514.42
5.5.30.0080.00314.46
5.5.20.0070.00514.48
5.5.10.0060.00814.52
5.5.00.0050.00814.43
5.4.450.0110.02114.22
5.4.440.0360.02913.95
5.4.430.0280.02414.08
5.4.420.0320.02414.15
5.4.410.0060.03014.04
5.4.400.0280.02513.86
5.4.390.0410.02513.84
5.4.380.0150.02113.62
5.4.370.0150.02413.81
5.4.360.0090.02413.73
5.4.350.0150.01713.73
5.4.340.0060.02313.86
5.4.330.0000.00711.31
5.4.320.0030.02311.77
5.4.310.0050.02011.73
5.4.300.0060.01511.78
5.4.290.0050.01811.76
5.4.280.0060.01511.76
5.4.270.0050.01911.77
5.4.260.0020.02011.69
5.4.250.0040.01711.63
5.4.240.0060.01711.70
5.4.230.0080.01411.74
5.4.220.0030.02111.74
5.4.210.0070.01711.70
5.4.200.0060.01911.69
5.4.190.0130.01813.82
5.4.180.0040.02213.81
5.4.170.0060.02813.90
5.4.160.0030.02313.92
5.4.150.0050.02913.78
5.4.140.0080.02713.07
5.4.130.0050.02113.18
5.4.120.0020.02213.06
5.4.110.0060.02313.05
5.4.100.0040.02713.04
5.4.90.0070.02013.05
5.4.80.0050.02013.07
5.4.70.0070.02212.98
5.4.60.0080.02713.13
5.4.50.0070.02313.10
5.4.40.0060.01713.12
5.4.30.0040.02213.06
5.4.20.0060.01913.03
5.4.10.0040.02213.11
5.4.00.0040.02012.92
5.3.290.0050.02011.69
5.3.280.0050.01711.66
5.3.270.0030.02412.19
5.3.260.0040.02212.29
5.3.250.0070.02512.24
5.3.240.0060.02112.25
5.3.230.0060.02312.27
5.3.220.0050.02212.27
5.3.210.0070.01912.23
5.3.200.0030.02212.22
5.3.190.0060.01912.24
5.3.180.0030.02112.22
5.3.170.0080.01712.31
5.3.160.0060.02012.30
5.3.150.0030.02312.25
5.3.140.0070.01712.24
5.3.130.0030.02212.28
5.3.120.0060.02012.27
5.3.110.0040.03112.27
5.3.100.0040.01912.05
5.3.90.0080.01912.16
5.3.80.0050.02712.03
5.3.70.0020.02312.01
5.3.60.0070.01712.05
5.3.50.0050.02512.08
5.3.40.0020.02412.04
5.3.30.0040.02112.08
5.3.20.0030.02212.04
5.3.10.0090.01811.88
5.3.00.0040.02011.90
5.2.170.0000.04711.30
5.2.160.0100.06311.41
5.2.150.0070.06311.22
5.2.140.0070.04011.41
5.2.130.0070.04011.27
5.2.120.0070.05711.23
5.2.110.0070.04011.23
5.2.100.0030.04011.29
5.2.90.0070.03711.24
5.2.80.0000.04311.35
5.2.70.0070.06011.23
5.2.60.0070.03711.22
5.2.50.0030.04311.19
5.2.40.0070.04711.18
5.2.30.0100.03311.14
5.2.20.0030.04311.27
5.2.10.0030.04311.11
5.2.00.0100.03310.88
5.1.60.0030.03310.23
5.1.50.0100.04310.16
5.1.40.0070.03010.03
5.1.30.0070.03310.59
5.1.20.0030.03710.59
5.1.10.0070.0339.93
5.1.00.0170.04010.04
5.0.50.0070.0338.55
5.0.40.0030.0278.67
5.0.30.0200.0408.30
5.0.20.0070.0238.41
5.0.10.0000.0438.29
5.0.00.0000.0578.27
4.4.90.0030.0205.92
4.4.80.0000.0235.83
4.4.70.0030.0205.82
4.4.60.0070.0175.84
4.4.50.0070.0275.81
4.4.40.0000.0375.83
4.4.30.0000.0235.82
4.4.20.0000.0235.87
4.4.10.0030.0205.89
4.4.00.0070.0305.84
4.3.110.0030.0335.74
4.3.100.0130.0135.78
4.3.90.0000.0235.75
4.3.80.0000.0335.73
4.3.70.0070.0275.73
4.3.60.0030.0205.73
4.3.50.0030.0235.80
4.3.40.0070.0305.67
4.3.30.0030.0205.48
4.3.20.0030.0205.48
4.3.10.0030.0205.48
4.3.00.0070.0208.11

preferences:
39.73 ms | 401 KiB | 5 Q