3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyXML extends SimpleXMLElement { public function firstChild() { $children = $this->children(); foreach ($children as $child) break; return $child; } public function keyHasTwins($key) { if (isset($this->$key)) return (count($this->$key)>1); else return false; } public function hasChildren() { return (bool)count($this->children()); } public function nodeIsCollection() { return count($this); } public function getChildrenKeys() { $all = []; $children = $this->children(); foreach ($children as $key => $child) { if (!in_array($key, $all)) $all[] = $key; } return $all; } } $s = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>'. '<request>'. ' <body>'. ' <rows>'. ' <row id="1"/>'. ' <row id="2"/>'. ' <row id="3"/>'. ' <row2 ver="2.0">test data</row2>'. ' <row2 ver="2.1">test data 2</row2>'. ' <row3 ver="3.0">'. ' <test inherit="yes">data</test>'. ' </row3>'. ' </rows>'. ' </body>'. '</request>'; $obj = new MyXML($s); $row = $obj->firstChild()->firstChild()->row2[0]; var_dump($row);

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.00718.64
8.3.50.0090.01022.03
8.3.40.0060.00919.04
8.3.30.0100.00618.83
8.3.20.0060.00318.98
8.3.10.0000.00821.30
8.3.00.0000.01021.98
8.2.180.0100.01016.63
8.2.170.0110.00722.96
8.2.160.0120.00320.53
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0030.00626.16
8.2.120.0040.00419.91
8.2.110.0030.00622.37
8.2.100.0040.00818.06
8.2.90.0030.00618.05
8.2.80.0070.00317.97
8.2.70.0040.00417.73
8.2.60.0000.00918.18
8.2.50.0080.00018.07
8.2.40.0040.00418.41
8.2.30.0080.00019.75
8.2.20.0030.00518.08
8.2.10.0040.00417.93
8.2.00.0040.00417.98
8.1.280.0110.00325.92
8.1.270.0090.00023.99
8.1.260.0060.01226.35
8.1.250.0080.00028.09
8.1.240.0080.00022.36
8.1.230.0110.00021.29
8.1.220.0080.00018.02
8.1.210.0030.00718.90
8.1.200.0030.00617.60
8.1.190.0050.00517.79
8.1.180.0000.00818.10
8.1.170.0050.00318.96
8.1.160.0000.00719.17
8.1.150.0030.00618.89
8.1.140.0000.00817.71
8.1.130.0040.00418.04
8.1.120.0000.01017.70
8.1.110.0000.00817.60
8.1.100.0040.00417.76
8.1.90.0000.00717.63
8.1.80.0040.00417.75
8.1.70.0050.00317.75
8.1.60.0040.00417.77
8.1.50.0000.00817.80
8.1.40.0070.00417.86
8.1.30.0040.00417.96
8.1.20.0040.00417.82
8.1.10.0000.00817.89
8.1.00.0080.00017.80
8.0.300.0080.00020.23
8.0.290.0020.00517.29
8.0.280.0080.00018.68
8.0.270.0000.00717.54
8.0.260.0000.00716.98
8.0.250.0000.00817.13
8.0.240.0040.00417.33
8.0.230.0080.00017.21
8.0.220.0030.00317.22
8.0.210.0000.00717.04
8.0.200.0000.00717.23
8.0.190.0040.00417.13
8.0.180.0000.00817.21
8.0.170.0000.00817.23
8.0.160.0000.00817.02
8.0.150.0040.00416.99
8.0.140.0020.00517.02
8.0.130.0030.00313.53
8.0.120.0030.00517.01
8.0.110.0000.00717.07
8.0.100.0000.00717.13
8.0.90.0050.00317.16
8.0.80.0090.00917.20
8.0.70.0000.00816.99
8.0.60.0000.00717.17
8.0.50.0070.00017.20
8.0.30.0170.00217.26
8.0.20.0120.00617.47
8.0.10.0040.00417.12
8.0.00.0130.00917.01
7.4.330.0050.00014.98
7.4.320.0070.00016.74
7.4.300.0030.00316.84
7.4.290.0030.00316.84
7.4.280.0030.00316.73
7.4.270.0040.00416.88
7.4.260.0000.00513.52
7.4.250.0040.00416.84
7.4.240.0070.00016.87
7.4.230.0030.00516.86
7.4.220.0060.01216.84
7.4.210.0090.00816.86
7.4.200.0040.00416.69
7.4.190.0080.00016.82
7.4.160.0170.00716.79
7.4.150.0070.01017.40
7.4.140.0110.00817.86
7.4.130.0110.00816.72
7.4.120.0080.01016.80
7.4.110.0100.01316.70
7.4.100.0130.01016.71
7.4.90.0090.00916.87
7.4.80.0040.01419.39
7.4.70.0070.01116.56
7.4.60.0070.01116.80
7.4.50.0060.00316.75
7.4.40.0120.00322.52
7.4.30.0070.01416.77
7.4.00.0050.01215.02
7.3.330.0000.00513.59
7.3.320.0030.00313.51
7.3.310.0070.00016.41
7.3.300.0030.00316.59
7.3.290.0100.00716.58
7.3.280.0130.00416.60
7.3.270.0150.00317.40
7.3.260.0140.00918.24
7.3.250.0120.00816.66
7.3.240.0070.01016.58
7.3.230.0090.00916.73
7.3.210.0090.01316.82
7.3.200.0110.00519.39
7.3.190.0130.01016.66
7.3.180.0060.01016.58
7.3.170.0110.00716.66
7.3.160.0100.00716.75
7.3.120.0050.01115.06
7.3.110.0030.01315.04
7.3.100.0070.00714.97
7.3.90.0030.00714.93
7.3.80.0030.01215.18
7.3.70.0060.00614.95
7.3.60.0100.00015.09
7.3.50.0040.00814.94
7.3.40.0100.00615.11
7.3.30.0030.00615.09
7.3.20.0080.00816.84
7.3.10.0090.00316.82
7.3.00.0060.00816.85
7.2.330.0120.00616.69
7.2.320.0150.00616.66
7.2.310.0110.01116.69
7.2.300.0060.01417.03
7.2.290.0030.01417.04
7.2.250.0030.01715.29
7.2.240.0070.01415.22
7.2.230.0090.00615.34
7.2.220.0040.01115.07
7.2.210.0040.01615.29
7.2.200.0120.00314.98
7.2.190.0080.00415.16
7.2.180.0100.00715.23
7.2.170.0110.00415.37
7.2.130.0100.00517.02
7.2.120.0050.00717.00
7.2.110.0080.00216.96
7.2.100.0060.00617.11
7.2.90.0040.00816.96
7.2.80.0050.00916.93
7.2.70.0090.00517.05
7.2.60.0050.00617.11
7.2.50.0020.01217.11
7.2.40.0050.00517.08
7.2.30.0050.01116.85
7.2.20.0070.00517.19
7.2.10.0050.01217.03
7.2.00.0050.00917.84
7.1.330.0070.01015.89
7.1.320.0070.00716.12
7.1.310.0150.00415.62
7.1.300.0040.00815.69
7.1.290.0030.01015.91
7.1.280.0120.00315.91
7.1.270.0060.00915.94
7.1.260.0060.00915.93
7.1.250.0040.00816.05
7.1.240.0100.00715.90
7.1.230.0070.01015.75
7.1.220.0060.00915.80
7.1.210.0030.00615.90
7.1.200.0080.00915.97
7.1.190.0140.00015.77
7.1.180.0000.01515.92
7.1.170.0050.00315.81
7.1.160.0100.00315.83
7.1.150.0030.01316.04
7.1.140.0000.01316.13
7.1.130.0090.00015.90
7.1.120.0040.00416.04
7.1.110.0040.00415.98
7.1.100.0110.00216.97
7.1.90.0100.00315.63
7.1.80.0040.01115.98
7.1.70.0030.00816.56
7.1.60.0040.01417.61
7.1.50.0050.00916.47
7.1.40.0000.00915.81
7.1.30.0070.00715.87
7.1.20.0150.00015.62
7.1.10.0040.01115.84
7.1.00.0030.04019.21
7.0.330.0000.01215.39
7.0.320.0120.00315.56
7.0.310.0030.01015.41
7.0.300.0100.00715.44
7.0.290.0030.01015.60
7.0.280.0070.00415.28
7.0.270.0060.00915.59
7.0.260.0060.00615.68
7.0.250.0050.00315.43
7.0.240.0050.00515.19
7.0.230.0100.00315.66
7.0.220.0080.00415.67
7.0.210.0100.00315.45
7.0.200.0060.00616.13
7.0.190.0090.00615.58
7.0.180.0030.01215.43
7.0.170.0000.00915.38
7.0.160.0030.00915.71
7.0.150.0100.00315.12
7.0.140.0070.03718.92
7.0.130.0000.01215.54
7.0.120.0030.01215.40
7.0.110.0090.00615.51
7.0.100.0030.00615.30
7.0.90.0110.00315.43
7.0.80.0040.01115.55
7.0.70.0600.02617.83
7.0.60.0380.04817.77
7.0.50.0470.04317.81
7.0.40.0120.03916.88
7.0.30.0050.04816.94
7.0.20.0050.04816.79
7.0.10.0070.04216.90
7.0.00.0070.03816.95
5.6.380.0040.00814.50
5.6.370.0130.00314.13
5.6.360.0100.00314.42
5.6.350.0030.00714.34
5.6.340.0070.01014.57
5.6.330.0080.00814.54
5.6.320.0090.00614.33
5.6.310.0140.00014.29
5.6.300.0070.00714.40
5.6.290.0000.01314.23
5.6.280.0030.04017.59
5.6.270.0060.00614.48
5.6.260.0060.00314.42
5.6.250.0090.00614.11
5.6.240.0080.00414.24
5.6.230.0000.01114.17
5.6.220.0070.04017.63
5.6.210.0050.03517.66
5.6.200.0090.04517.86
5.6.190.0100.04317.73
5.6.180.0000.05117.78
5.6.170.0070.04817.89
5.6.160.0040.04717.63
5.6.150.0060.04517.80
5.6.140.0090.04317.78
5.6.130.0050.04017.95
5.6.120.0070.04317.82
5.6.110.0100.02518.01
5.6.100.0030.04517.71
5.6.90.0030.03117.57
5.6.80.0080.04517.53
5.6.70.0080.04217.23
5.6.60.0060.04317.42
5.6.50.0030.02817.61
5.6.40.0120.03817.54
5.6.30.0120.03817.35
5.6.20.0040.03417.37
5.6.10.0110.04117.32
5.6.00.0000.03017.48
5.5.380.0030.00611.39
5.5.370.0030.01011.26
5.5.360.0100.03315.85
5.5.350.0080.04715.76
5.5.340.0030.04116.14
5.5.330.0020.04815.99
5.5.320.0100.04316.03
5.5.310.0050.04816.27
5.5.300.0030.04416.26
5.5.290.0080.04016.10
5.5.280.0040.04616.19
5.5.270.0030.05016.13
5.5.260.0040.04215.97
5.5.250.0050.03715.96
5.5.240.0000.04215.82
5.5.230.0080.04015.78
5.5.220.0040.02715.88
5.5.210.0040.03215.79
5.5.200.0080.03815.83
5.5.190.0070.04415.55
5.5.180.0050.04315.67
5.5.170.0030.00311.32
5.5.160.0100.03715.71
5.5.150.0030.04615.72
5.5.140.0130.03815.65
5.5.130.0110.04015.78
5.5.120.0060.03815.85
5.5.110.0050.04215.80
5.5.100.0080.03915.72
5.5.90.0070.03015.61
5.5.80.0090.04015.81
5.5.70.0070.04215.72
5.5.60.0060.02415.73
5.5.50.0070.02615.52
5.5.40.0060.04115.55
5.5.30.0040.02515.66
5.5.20.0080.04015.73
5.5.10.0020.04515.68
5.5.00.0070.04215.59
5.4.450.0080.04615.58
5.4.440.0050.04415.25
5.4.430.0100.04115.25
5.4.420.0080.04215.19
5.4.410.0050.04415.30
5.4.400.0070.03315.13
5.4.390.0030.04615.07
5.4.380.0120.03215.08
5.4.370.0030.02915.38
5.4.360.0050.02315.15
5.4.350.0030.04215.28
5.4.340.0150.03315.13
5.4.330.0030.01011.20
5.4.320.0030.02115.14
5.4.310.0080.03815.21
5.4.300.0080.04215.22
5.4.290.0030.04015.19
5.4.280.0030.04515.23
5.4.270.0050.04515.33
5.4.260.0060.03615.32
5.4.250.0020.04515.19
5.4.240.0050.04215.15
5.4.230.0070.03415.08
5.4.220.0040.02215.23
5.4.210.0010.04315.28
5.4.200.0090.02115.27
5.4.190.0030.03615.10
5.4.180.0060.02715.21
5.4.170.0020.04415.30
5.4.160.0060.04315.09
5.4.150.0070.04215.18
5.4.140.0000.04614.03
5.4.130.0050.04013.93
5.4.120.0080.03813.90
5.4.110.0020.04513.80
5.4.100.0050.02313.74
5.4.90.0080.03713.93
5.4.80.0010.03413.83
5.4.70.0020.04213.78
5.4.60.0050.04013.71
5.4.50.0080.03513.90
5.4.40.0090.04013.84
5.4.30.0080.03813.88
5.4.20.0120.03313.96
5.4.10.0050.04013.82
5.4.00.0070.04013.63
5.3.290.0000.04512.49
5.3.280.0050.02212.49
5.3.270.0020.04212.53
5.3.260.0040.03112.47
5.3.250.0100.03512.46
5.3.240.0000.04412.39
5.3.230.0060.03812.43
5.3.220.0040.02212.29
5.3.210.0030.02312.32
5.3.200.0030.03612.41
5.3.190.0070.03512.37
5.3.180.0030.02012.60
5.3.170.0100.03912.43
5.3.160.0060.03212.44
5.3.150.0030.03812.47
5.3.140.0030.03312.46
5.3.130.0050.03612.55
5.3.120.0040.04012.48
5.3.110.0000.04712.51
5.3.100.0020.03312.29
5.3.90.0050.04012.29
5.3.80.0070.04012.12
5.3.70.0050.03612.11
5.3.60.0090.03912.23
5.3.50.0080.03812.12
5.3.40.0020.04512.11
5.3.30.0100.02912.04
5.3.20.0070.02811.93
5.3.10.0050.03411.89
5.3.00.0050.03611.83
5.2.170.0080.03310.63
5.2.160.0070.03210.53
5.2.150.0050.03310.59
5.2.140.0070.02310.50
5.2.130.0050.02510.57
5.2.120.0060.03410.53
5.2.110.0030.03310.58
5.2.100.0090.02810.59
5.2.90.0070.03210.47
5.2.80.0030.02710.48
5.2.70.0020.03510.49
5.2.60.0050.02710.54
5.2.50.0050.03510.45
5.2.40.0020.02710.53
5.2.30.0020.03510.44
5.2.20.0030.03410.48
5.2.10.0030.02610.47
5.2.00.0050.03210.31
5.1.60.0020.02810.30
5.1.50.0070.02810.30
5.1.40.0050.02910.30
5.1.30.0050.02310.30
5.1.20.0060.02510.30
5.1.10.0030.03110.30
5.1.00.0040.03210.30
5.0.50.0020.02010.30
5.0.40.0020.01310.30
5.0.30.0040.01810.30
5.0.20.0040.02010.30
5.0.10.0030.02410.30
5.0.00.0060.03110.30
4.4.90.0020.02210.30
4.4.80.0050.01710.30
4.4.70.0020.02210.30
4.4.60.0020.02210.30
4.4.50.0070.01410.30
4.4.40.0030.02510.30
4.4.30.0050.01910.30
4.4.20.0030.01610.30
4.4.10.0000.01610.30
4.4.00.0020.03010.30
4.3.110.0000.01310.30
4.3.100.0020.01210.30
4.3.90.0030.01710.30
4.3.80.0000.03210.30
4.3.70.0000.01510.30
4.3.60.0040.01310.30
4.3.50.0020.02210.30
4.3.40.0040.02310.30
4.3.30.0020.01510.30
4.3.20.0020.02210.30
4.3.10.0010.01510.30
4.3.00.0020.01210.30

preferences:
43.69 ms | 401 KiB | 5 Q