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; 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.0130.01017.00
8.3.50.0140.00717.60
8.3.40.0050.01019.09
8.3.30.0110.00319.14
8.3.20.0080.00019.02
8.3.10.0060.00320.73
8.3.00.0000.00817.71
8.2.180.0040.01117.13
8.2.170.0190.00022.96
8.2.160.0110.00422.38
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0070.00020.01
8.2.110.0060.00321.25
8.2.100.0120.00018.03
8.2.90.0080.00319.50
8.2.80.0000.00818.16
8.2.70.0090.00017.75
8.2.60.0050.00318.16
8.2.50.0000.00818.07
8.2.40.0060.00318.41
8.2.30.0000.00818.40
8.2.20.0040.00417.97
8.2.10.0030.00618.11
8.2.00.0060.00317.89
8.1.280.0080.00825.92
8.1.270.0050.00324.66
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00321.08
8.1.230.0090.00321.22
8.1.220.0000.00818.15
8.1.210.0080.00019.22
8.1.200.0070.00317.60
8.1.190.0060.00317.76
8.1.180.0040.00418.10
8.1.170.0040.00419.14
8.1.160.0040.00419.12
8.1.150.0090.00018.96
8.1.140.0070.00317.66
8.1.130.0000.00718.09
8.1.120.0000.00717.59
8.1.110.0070.00017.68
8.1.100.0030.00517.64
8.1.90.0050.00317.73
8.1.80.0000.00717.73
8.1.70.0030.00317.73
8.1.60.0040.00417.87
8.1.50.0000.00817.59
8.1.40.0000.00717.85
8.1.30.0000.00717.81
8.1.20.0080.00017.78
8.1.10.0080.00017.70
8.1.00.0000.00817.78
8.0.300.0050.00220.26
8.0.290.0040.00417.00
8.0.280.0070.00018.71
8.0.270.0040.00417.53
8.0.260.0030.00316.97
8.0.250.0000.00717.14
8.0.240.0000.00817.12
8.0.230.0030.00317.13
8.0.220.0070.00017.13
8.0.210.0070.00017.15
8.0.200.0040.00417.24
8.0.190.0040.00417.11
8.0.180.0040.00417.08
8.0.170.0030.00617.22
8.0.160.0030.00617.01
8.0.150.0040.00417.03
8.0.140.0040.00417.17
8.0.130.0030.00313.65
8.0.120.0070.00017.03
8.0.110.0040.00417.07
8.0.100.0000.00817.23
8.0.90.0030.00517.18
8.0.80.0060.01017.09
8.0.70.0050.00317.01
8.0.60.0050.00316.90
8.0.50.0050.00317.17
8.0.30.0020.01717.39
8.0.20.0130.00517.30
8.0.10.0070.00017.19
8.0.00.0090.00916.90
7.4.330.0030.00314.91
7.4.320.0070.00016.83
7.4.300.0070.00016.68
7.4.290.0030.00316.82
7.4.280.0030.00616.88
7.4.270.0000.00716.96
7.4.260.0060.00013.55
7.4.250.0030.00616.70
7.4.240.0020.00516.94
7.4.230.0030.00316.97
7.4.220.0040.01216.76
7.4.210.0060.01116.93
7.4.200.0070.00016.68
7.4.190.0040.00416.89
7.4.160.0040.01216.74
7.4.150.0070.01117.07
7.4.140.0130.00717.28
7.4.130.0110.01216.81
7.4.120.0070.01116.81
7.4.110.0100.01316.91
7.4.100.0090.00916.77
7.4.90.0160.00316.64
7.4.80.0090.00918.63
7.4.70.0060.01516.82
7.4.60.0070.01116.67
7.4.50.0000.00920.34
7.4.40.0070.00721.69
7.4.30.0120.00416.81
7.4.00.0060.00714.92
7.3.330.0030.00313.34
7.3.320.0020.00513.35
7.3.310.0000.00716.50
7.3.300.0000.00716.54
7.3.290.0090.00616.55
7.3.280.0080.00816.54
7.3.270.0120.00617.07
7.3.260.0070.01018.24
7.3.250.0110.00816.63
7.3.240.0030.01416.82
7.3.230.0060.01716.90
7.3.210.0100.00716.63
7.3.200.0080.01419.39
7.3.190.0060.01316.60
7.3.180.0040.01116.51
7.3.170.0140.00316.78
7.3.160.0100.00616.73
7.3.120.0070.01115.16
7.2.330.0090.00916.71
7.2.320.0070.01017.01
7.2.310.0030.01716.87
7.2.300.0100.00716.96
7.2.290.0030.01516.98
7.2.60.0060.00917.10
7.2.00.0040.00719.31
7.1.200.0060.00615.78
7.1.100.0000.01418.15
7.1.70.0030.00517.40
7.1.60.0060.01919.40
7.1.50.0100.00316.75
7.1.00.0000.03722.49
7.0.200.0030.00316.94
7.0.140.0030.07722.18
7.0.120.0030.03022.11
7.0.60.0070.08021.94
7.0.50.0030.04017.90
7.0.40.0030.04320.44
7.0.30.0300.04020.41
7.0.20.0300.04720.32
7.0.10.0100.04020.40
7.0.00.0070.08720.20
5.6.280.0030.07321.07
5.6.210.0130.03720.83
5.6.200.0000.04718.31
5.6.190.0130.07720.49
5.6.180.0200.04320.59
5.6.170.0330.06320.59
5.6.160.0000.04720.55
5.6.150.0070.07018.23
5.6.140.0070.07018.32
5.6.130.0030.05018.22
5.6.120.0130.08021.01
5.6.110.0100.06721.02
5.6.100.0130.07721.24
5.6.90.0030.04321.03
5.6.80.0100.03720.53
5.5.350.0070.04320.60
5.5.340.0100.07017.99
5.5.330.0000.05720.35
5.5.320.0270.06320.38
5.5.310.0300.06020.58
5.5.300.0070.03718.11
5.5.290.0070.03718.11
5.5.280.0130.04320.94
5.5.270.0030.08320.89
5.5.260.0070.05720.90
5.5.250.0070.04320.84
5.5.240.0100.06720.25
5.4.450.0000.08319.58
5.4.440.0030.05319.27
5.4.430.0130.06319.70
5.4.420.0170.04319.61
5.4.410.0070.04019.27
5.4.400.0030.07719.36
5.4.390.0070.07719.35
5.4.380.0070.07319.29
5.4.370.0100.05319.28
5.4.360.0070.05719.38
5.4.350.0130.07318.93
5.4.340.0100.06718.95
5.4.320.0070.06019.05
5.4.310.0070.06718.93
5.4.300.0070.07019.38
5.4.290.0030.04019.22
5.4.280.0030.04019.05
5.4.270.0130.03718.93
5.4.260.0000.06018.95
5.4.250.0070.03719.44
5.4.240.0030.04319.05
5.4.230.0100.06718.94
5.4.220.0100.06718.92
5.4.210.0070.07319.05
5.4.200.0030.05319.37
5.4.190.0070.04719.34
5.4.180.0000.08319.22
5.4.170.0100.05719.37
5.4.160.0070.05319.14
5.4.150.0100.07319.17
5.4.140.0070.07316.68
5.4.130.0130.06316.38
5.4.120.0070.03716.64
5.4.110.0000.05016.59
5.4.100.0130.05016.72
5.4.90.0030.04316.58
5.4.80.0030.04016.57
5.4.70.0100.04316.78
5.4.60.0030.05716.56
5.4.50.0070.06316.51
5.4.40.0030.03716.40
5.4.30.0070.04016.43
5.4.20.0070.03316.70
5.4.10.0100.07316.52
5.4.00.0030.06015.84
5.3.290.0030.07714.83
5.3.280.0100.07014.76
5.3.270.0100.04014.68
5.3.260.0100.04714.62
5.3.250.0130.05714.64
5.3.240.0130.04014.64
5.3.230.0100.07314.66
5.3.220.0070.03314.58
5.3.210.0070.06714.65
5.3.200.0030.04714.60
5.3.190.0030.04014.61
5.3.180.0000.04014.63
5.3.170.0070.03314.58
5.3.160.0070.06714.50
5.3.150.0030.08314.59
5.3.140.0030.05014.56
5.3.130.0070.07014.59
5.3.120.0030.04314.72
5.3.110.0030.05314.62
5.3.100.0100.06314.20
5.3.90.0070.05014.04
5.3.80.0030.04713.94
5.3.70.0070.04314.05
5.3.60.0130.07013.90
5.3.50.0130.04713.98
5.3.40.0030.07013.98
5.3.30.0070.05713.93
5.3.20.0030.06013.75
5.3.10.0000.04713.81
5.3.00.0030.07013.67
5.2.170.0070.05311.12
5.2.160.0070.05711.05
5.2.150.0100.05711.05
5.2.140.0130.05311.17
5.2.130.0000.05011.12
5.2.120.0000.03311.16
5.2.110.0070.03011.18
5.2.100.0000.04711.03
5.2.90.0100.06011.16
5.2.80.0070.05710.99
5.2.70.0070.05711.06
5.2.60.0100.05711.14
5.2.50.0130.03011.10
5.2.40.0000.03710.97
5.2.30.0000.03011.13
5.2.20.0170.05010.89
5.2.10.0100.05710.87
5.2.00.0030.03710.73
5.1.60.0070.02710.07
5.1.50.0030.05710.16
5.1.40.0100.02310.13
5.1.30.0000.03710.36
5.1.20.0100.05010.25
5.1.10.0030.03710.22
5.1.00.0070.04710.09
5.0.50.0030.0478.62
5.0.40.0000.0408.55
5.0.30.0070.0608.55
5.0.20.0000.0308.55
5.0.10.0070.0308.55
5.0.00.0000.0478.55
4.4.90.0070.0208.55
4.4.80.0000.0278.55
4.4.70.0030.0138.55
4.4.60.0000.0278.55
4.4.50.0100.0278.55
4.4.40.0070.0478.55
4.4.30.0030.0178.55
4.4.20.0000.0378.55
4.4.10.0030.0178.55
4.4.00.0000.0538.55
4.3.110.0070.0208.55
4.3.100.0000.0378.55
4.3.90.0070.0278.55
4.3.80.0030.0438.55
4.3.70.0000.0308.55
4.3.60.0070.0308.55
4.3.50.0030.0378.55
4.3.40.0000.0438.55
4.3.30.0000.0338.55
4.3.20.0000.0208.55
4.3.10.0030.0138.55
4.3.00.0000.0208.55

preferences:
55.9 ms | 401 KiB | 5 Q