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() { 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.0100.01018.53
8.3.50.0140.00822.30
8.3.40.0110.00719.22
8.3.30.0110.00419.34
8.3.20.0040.00420.54
8.3.10.0000.00822.34
8.3.00.0000.00822.69
8.2.180.0130.00316.88
8.2.170.0120.00622.96
8.2.160.0100.00321.27
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0050.00319.73
8.2.110.0030.00622.39
8.2.100.0080.00419.89
8.2.90.0080.00019.47
8.2.80.0000.00818.18
8.2.70.0000.00817.75
8.2.60.0090.00018.41
8.2.50.0030.00518.07
8.2.40.0060.00318.47
8.2.30.0030.00618.41
8.2.20.0000.00818.03
8.2.10.0030.00619.80
8.2.00.0000.00818.09
8.1.280.0110.00725.92
8.1.270.0080.00024.09
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0000.00923.97
8.1.230.0000.01119.38
8.1.220.0000.00817.91
8.1.210.0000.00818.77
8.1.200.0000.00917.48
8.1.190.0060.00317.55
8.1.180.0060.00319.02
8.1.170.0050.00318.76
8.1.160.0030.00522.17
8.1.150.0000.00818.88
8.1.140.0020.00517.73
8.1.130.0030.00318.14
8.1.120.0030.00517.77
8.1.110.0000.00817.61
8.1.100.0020.00517.64
8.1.90.0000.00717.58
8.1.80.0040.00417.77
8.1.70.0000.00717.70
8.1.60.0050.00317.85
8.1.50.0030.00717.85
8.1.40.0000.00817.65
8.1.30.0000.00817.79
8.1.20.0030.00517.78
8.1.10.0040.00417.92
8.1.00.0040.00417.82
8.0.300.0000.00718.77
8.0.290.0050.00217.54
8.0.280.0030.00318.77
8.0.270.0000.00717.61
8.0.260.0000.00717.16
8.0.250.0040.00417.28
8.0.240.0070.00017.25
8.0.230.0030.00317.28
8.0.220.0030.00317.19
8.0.210.0040.00417.14
8.0.200.0030.00317.22
8.0.190.0060.00317.12
8.0.180.0040.00417.09
8.0.170.0030.00517.14
8.0.160.0000.00717.17
8.0.150.0040.00417.10
8.0.140.0040.00417.11
8.0.130.0060.00013.63
8.0.120.0050.00317.14
8.0.110.0050.00317.14
8.0.100.0000.00716.96
8.0.90.0040.00417.12
8.0.80.0060.00917.23
8.0.70.0040.00416.99
8.0.60.0040.00417.23
8.0.50.0070.00017.21
8.0.30.0100.01317.26
8.0.20.0100.00817.59
8.0.10.0000.00717.16
8.0.00.0170.00617.08
7.4.330.0000.00615.20
7.4.320.0050.00216.80
7.4.300.0070.00016.70
7.4.290.0000.00716.84
7.4.280.0000.00716.67
7.4.270.0050.00316.91
7.4.260.0030.00316.63
7.4.250.0050.00316.89
7.4.240.0000.00716.84
7.4.230.0070.00016.97
7.4.220.0120.00916.96
7.4.210.0100.00916.88
7.4.200.0000.00716.84
7.4.190.0000.00716.97
7.4.160.0100.00716.75
7.4.150.0110.00717.40
7.4.140.0130.00717.86
7.4.130.0120.00816.87
7.4.120.0130.00516.81
7.4.110.0120.00416.96
7.4.100.0150.00316.86
7.4.90.0030.01416.66
7.4.80.0070.01019.39
7.4.70.0060.01016.72
7.4.60.0030.01316.89
7.4.50.0000.00416.58
7.4.40.0070.00722.77
7.4.30.0120.00416.84
7.4.00.0090.00814.97
7.3.330.0030.00313.64
7.3.320.0050.00013.47
7.3.310.0000.00716.66
7.3.300.0030.00316.54
7.3.290.0120.00316.60
7.3.280.0080.01316.59
7.3.270.0080.00817.40
7.3.260.0100.00716.66
7.3.250.0150.00516.71
7.3.240.0040.01416.88
7.3.230.0030.01616.79
7.3.210.0080.01216.57
7.3.200.0120.00919.39
7.3.190.0030.01416.84
7.3.180.0100.00716.70
7.3.170.0080.00816.66
7.3.160.0130.00616.68
7.3.120.0060.01115.08
7.3.110.0050.01115.03
7.3.100.0080.00815.16
7.3.90.0080.00815.01
7.3.80.0100.00315.13
7.3.70.0090.00615.06
7.3.60.0040.00715.07
7.3.50.0080.00815.01
7.3.40.0060.00814.95
7.3.30.0070.00714.99
7.3.20.0090.00616.78
7.3.10.0060.00916.69
7.3.00.0060.00716.89
7.2.330.0090.00917.04
7.2.320.0130.01017.07
7.2.310.0130.01016.93
7.2.300.0040.01217.00
7.2.290.0060.01017.02
7.2.250.0000.01915.30
7.2.240.0120.00615.16
7.2.230.0070.00915.25
7.2.220.0040.01115.24
7.2.210.0070.00615.22
7.2.200.0020.01115.27
7.2.190.0090.00715.28
7.2.180.0070.01015.25
7.2.170.0070.00715.18
7.2.160.0070.01015.14
7.2.150.0060.00617.32
7.2.140.0070.00716.94
7.2.130.0040.00817.03
7.2.120.0060.00717.03
7.2.110.0070.00617.12
7.2.100.0050.00717.06
7.2.90.0060.00917.08
7.2.80.0060.00617.02
7.2.70.0090.00217.05
7.2.60.0080.00517.14
7.2.50.0050.01017.14
7.2.40.0060.00817.05
7.2.30.0090.00717.03
7.2.20.0060.00617.10
7.2.10.0050.01117.08
7.2.00.0050.00817.68
7.1.330.0070.00815.84
7.1.320.0030.00815.87
7.1.310.0080.00515.97
7.1.300.0040.00916.03
7.1.290.0030.00815.95
7.1.280.0110.00315.89
7.1.270.0070.00815.85
7.1.260.0090.00416.04
7.1.250.0010.01015.85
7.1.240.0030.00615.75
7.1.230.0070.00315.88
7.1.220.0040.01115.96
7.1.210.0070.00715.83
7.1.200.0050.00316.10
7.1.190.0030.00915.77
7.1.180.0060.00615.96
7.1.170.0060.00615.69
7.1.160.0100.00315.89
7.1.150.0000.01416.05
7.1.140.0060.00615.92
7.1.130.0030.01015.85
7.1.120.0040.01116.00
7.1.110.0090.00616.19
7.1.100.0050.00817.00
7.1.90.0000.00915.88
7.1.80.0090.00315.74
7.1.70.0020.00916.61
7.1.60.0060.01217.88
7.1.50.0080.01016.41
7.1.40.0060.00915.87
7.1.30.0090.00915.91
7.1.20.0040.01115.77
7.1.10.0080.01115.80
7.1.00.0090.03819.16
7.0.330.0130.00015.56
7.0.320.0030.00615.46
7.0.310.0060.00615.41
7.0.300.0040.00415.48
7.0.290.0060.00315.52
7.0.280.0060.00615.39
7.0.270.0030.01315.41
7.0.260.0060.00615.46
7.0.250.0060.00615.32
7.0.240.0030.00515.63
7.0.230.0000.01215.55
7.0.220.0000.01115.30
7.0.210.0030.00915.45
7.0.200.0090.00516.18
7.0.190.0030.00915.62
7.0.180.0080.00415.42
7.0.170.0040.00815.48
7.0.160.0060.00915.51
7.0.150.0090.00315.39
7.0.140.0050.04318.86
7.0.130.0000.01215.59
7.0.120.0040.01115.47
7.0.110.0040.00415.46
7.0.100.0100.00315.41
7.0.90.0030.00615.20
7.0.80.0030.00815.40
7.0.70.0070.01015.54
7.0.60.0120.02817.73
7.0.50.0050.04916.81
7.0.40.0070.02517.02
7.0.30.0170.02416.88
7.0.20.0100.04716.94
7.0.10.0120.02916.87
7.0.00.0030.03316.90
5.6.380.0030.01314.98
5.6.370.0080.00514.72
5.6.360.0030.01014.45
5.6.350.0030.01014.65
5.6.340.0110.00414.20
5.6.330.0030.00514.58
5.6.320.0070.00714.18
5.6.310.0030.00614.28
5.6.300.0090.00614.60
5.6.290.0000.00814.46
5.6.280.0000.04317.80
5.6.270.0030.00914.59
5.6.260.0040.00814.59
5.6.250.0030.00614.51
5.6.240.0030.01014.60
5.6.230.0110.00414.70
5.6.220.0040.01114.46
5.6.210.0080.02317.69
5.6.200.0070.02516.51
5.6.190.0080.04317.46
5.6.180.1960.02317.55
5.6.170.0170.04817.75
5.6.160.0070.02517.64
5.6.150.0070.04216.41
5.6.140.0060.04116.48
5.6.130.0060.02916.30
5.6.120.0110.04117.77
5.6.110.0110.03517.69
5.6.100.0050.04117.71
5.6.90.0060.04117.75
5.6.80.0030.04517.64
5.6.70.0210.03817.46
5.6.60.0000.01414.25
5.6.50.0150.00014.27
5.6.40.0040.01014.68
5.6.30.0030.01014.35
5.6.20.0040.01214.25
5.6.10.0060.00314.26
5.6.00.0060.00914.32
5.5.380.0060.00611.28
5.5.370.0060.00611.39
5.5.360.0040.00711.40
5.5.350.0100.04015.92
5.5.340.0040.03214.87
5.5.330.0070.03715.86
5.5.320.0170.04215.95
5.5.310.0170.04015.93
5.5.300.0020.04614.72
5.5.290.0120.03914.70
5.5.280.0100.04016.02
5.5.270.0070.03515.98
5.5.260.0030.03116.19
5.5.250.0070.04516.05
5.5.240.0100.03015.70
5.5.230.0000.00811.29
5.5.220.0030.00311.36
5.5.210.0060.00611.18
5.5.200.0030.00811.18
5.5.190.0040.00411.53
5.5.180.0030.00311.18
5.5.170.0000.01211.27
5.5.160.0040.00411.36
5.5.150.0030.00711.46
5.5.140.0040.00711.33
5.5.130.0070.00011.25
5.5.120.0070.00311.29
5.5.110.0000.00711.18
5.5.100.0040.00811.36
5.5.90.0040.00811.29
5.5.80.0070.00711.30
5.5.70.0060.00311.18
5.5.60.0060.00611.18
5.5.50.0000.01011.18
5.5.40.0030.00711.18
5.5.30.0030.00711.29
5.5.20.0080.00311.18
5.5.10.0000.01011.26
5.5.00.0000.01011.20
5.4.450.0920.02815.31
5.4.440.0830.03015.27
5.4.430.0900.02515.38
5.4.420.0870.02715.44
5.4.410.0890.02615.40
5.4.400.0750.02415.17
5.4.390.0770.02015.16
5.4.380.0790.01815.31
5.4.370.0760.02315.13
5.4.360.1000.02015.24
5.4.350.0920.02515.31
5.4.340.0820.02115.14
5.4.330.0030.00311.37
5.4.320.0870.02515.20
5.4.310.0930.02615.18
5.4.300.0800.03315.07
5.4.290.0750.02515.21
5.4.280.0830.02815.09
5.4.270.0830.01815.14
5.4.260.0770.02215.14
5.4.250.0760.02515.13
5.4.240.0800.02215.20
5.4.230.0790.02815.24
5.4.220.0870.02415.09
5.4.210.0930.02415.26
5.4.200.0800.02515.20
5.4.190.0770.02515.13
5.4.180.0950.02715.11
5.4.170.0970.02315.12
5.4.160.0860.02315.16
5.4.150.0800.02315.13
5.4.140.0770.02413.86
5.4.130.0780.02013.88
5.4.120.0820.02013.91
5.4.110.0780.02213.85
5.4.100.0880.02113.95
5.4.90.0900.02313.90
5.4.80.0010.02413.93
5.4.70.0020.03714.05
5.4.60.0070.03613.85
5.4.50.0850.02614.02
5.4.40.0780.02413.91
5.4.30.0800.03513.92
5.4.20.0920.02013.87
5.4.10.0870.02713.89
5.4.00.0880.02813.63
5.3.290.0730.02513.08
5.3.280.0830.02613.00
5.3.270.0780.02012.93
5.3.260.0870.02612.92
5.3.250.0880.02612.93
5.3.240.0950.02212.98
5.3.230.0870.02413.04
5.3.220.0870.02712.96
5.3.210.0830.02012.91
5.3.200.0930.02112.99
5.3.190.0880.02812.96
5.3.180.0830.01912.98
5.3.170.0730.02212.98
5.3.160.0780.02512.90
5.3.150.0930.02212.96
5.3.140.0750.02412.92
5.3.130.0850.02712.90
5.3.120.0870.02412.89
5.3.110.0950.02512.92
5.3.100.0790.02012.65
5.3.90.0810.02012.65
5.3.80.0890.02612.63
5.3.70.0900.02512.72
5.3.60.0790.01812.68
5.3.50.0870.02712.61
5.3.40.0770.02212.68
5.3.30.0920.02612.58
5.3.20.0880.02312.53
5.3.10.0950.02312.42
5.3.00.0150.03212.45
5.2.170.0060.01611.20
5.2.160.0020.01911.21
5.2.150.0170.01511.26
5.2.140.0800.02511.27
5.2.130.0620.02011.23
5.2.120.0620.02011.31
5.2.110.0620.02011.23
5.2.100.0780.02011.27
5.2.90.0690.01511.26
5.2.80.0830.02211.22
5.2.70.0700.02311.23
5.2.60.0680.01611.15
5.2.50.0630.01611.14
5.2.40.0570.02511.09
5.2.30.0560.01711.11
5.2.20.0530.01511.08
5.2.10.0250.02011.14
5.2.00.0030.01711.11
5.1.60.0000.01910.72
5.1.50.0010.01610.61
5.1.40.0040.01310.70
5.1.30.0270.01710.86
5.1.20.0610.01610.78
5.1.10.0530.01610.66
5.1.00.0660.01710.58
5.0.50.0330.0169.82
5.0.40.0250.0139.76
5.0.30.0320.0229.70
5.0.20.0250.0139.76
5.0.10.0330.0129.69
5.0.00.0270.0199.79
4.4.90.0250.0119.69
4.4.80.0280.0129.69
4.4.70.0350.0099.69
4.4.60.0300.0109.69
4.4.50.0290.0099.69
4.4.40.0290.0139.69
4.4.30.0330.0109.69
4.4.20.0280.0109.69
4.4.10.0290.0079.69
4.4.00.0300.0139.69
4.3.110.0250.0109.69
4.3.100.0030.0079.69
4.3.90.0030.0079.69
4.3.80.0010.0139.69
4.3.70.0000.0109.69
4.3.60.0020.0109.69
4.3.50.0020.0159.69
4.3.40.0020.0139.69
4.3.30.0000.0099.69
4.3.20.0010.0109.69
4.3.10.0020.0089.69
4.3.00.0030.0109.69

preferences:
51.74 ms | 401 KiB | 5 Q