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; } public function getValue() { foreach ($this as $val) break; return $val; } } $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>'. ' <row4 ver="4.0">my test data</row4>'. ' </rows>'. ' </body>'. '</request>'; $obj = new MyXML($s); $row = $obj->firstChild()->firstChild()->row4; var_dump($row->getValue());

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.0080.01117.00
8.3.50.0090.01218.49
8.3.40.0100.01018.97
8.3.30.0120.00918.90
8.3.20.0040.00418.99
8.3.10.0090.00020.73
8.3.00.0040.00417.84
8.2.180.0070.01416.88
8.2.170.0140.00422.96
8.2.160.0000.01422.33
8.2.150.0070.00324.18
8.2.140.0050.00324.66
8.2.130.0050.00326.16
8.2.120.0040.00420.08
8.2.110.0070.00321.31
8.2.100.0000.01217.97
8.2.90.0060.00321.15
8.2.80.0040.00418.29
8.2.70.0040.00417.75
8.2.60.0000.00818.05
8.2.50.0030.00518.07
8.2.40.0030.00518.34
8.2.30.0060.00318.44
8.2.20.0040.00417.98
8.2.10.0040.00418.05
8.2.00.0040.00417.96
8.1.280.0140.00725.92
8.1.270.0080.00024.66
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0030.00621.07
8.1.230.0030.00821.29
8.1.220.0000.00818.02
8.1.210.0040.00419.29
8.1.200.0000.01017.60
8.1.190.0040.00417.66
8.1.180.0040.00418.10
8.1.170.0080.00019.21
8.1.160.0040.00419.05
8.1.150.0030.00618.94
8.1.140.0000.00917.67
8.1.130.0000.00718.09
8.1.120.0040.00417.79
8.1.110.0000.00817.73
8.1.100.0000.00817.78
8.1.90.0000.00817.63
8.1.80.0030.00317.61
8.1.70.0000.00817.57
8.1.60.0000.00917.78
8.1.50.0000.00917.69
8.1.40.0030.00617.86
8.1.30.0000.00717.78
8.1.20.0050.00318.02
8.1.10.0030.00617.88
8.1.00.0030.00617.77
8.0.300.0070.00320.40
8.0.290.0040.00417.13
8.0.280.0040.00418.71
8.0.270.0030.00317.58
8.0.260.0030.00317.09
8.0.250.0070.00017.14
8.0.240.0000.00717.27
8.0.230.0040.00417.11
8.0.220.0030.00317.08
8.0.210.0040.00417.11
8.0.200.0060.00017.29
8.0.190.0090.00317.17
8.0.180.0040.00417.08
8.0.170.0030.00517.24
8.0.160.0070.00017.14
8.0.150.0060.00317.00
8.0.140.0080.00316.98
8.0.130.0030.00313.68
8.0.120.0040.00417.19
8.0.110.0070.00017.10
8.0.100.0000.00717.20
8.0.90.0080.00016.96
8.0.80.0120.00417.21
8.0.70.0040.00417.12
8.0.60.0000.00817.11
8.0.50.0040.00417.13
8.0.30.0110.01117.33
8.0.20.0100.00817.52
8.0.10.0080.00017.03
8.0.00.0080.01217.15
7.4.330.0000.00513.21
7.4.320.0000.00716.79
7.4.300.0030.00316.73
7.4.290.0000.00716.81
7.4.280.0050.00316.86
7.4.270.0040.00416.79
7.4.260.0000.00613.65
7.4.250.0040.00416.89
7.4.240.0000.00716.79
7.4.230.0070.00016.78
7.4.220.0160.00916.66
7.4.210.0050.01116.90
7.4.200.0040.00416.74
7.4.190.0000.00716.90
7.4.160.0120.00416.66
7.4.150.0090.00916.73
7.4.140.0060.01316.74
7.4.130.0090.01216.80
7.4.120.0100.00716.59
7.4.110.0150.00316.73
7.4.100.0160.00316.70
7.4.90.0070.01116.84
7.4.80.0060.01216.92
7.4.70.0140.01316.65
7.4.60.0110.00716.77
7.4.50.0060.00316.91
7.4.40.0070.00316.70
7.4.30.0120.00416.81
7.4.00.0030.01015.09
7.3.330.0060.00013.34
7.3.320.0000.00613.34
7.3.310.0030.00316.45
7.3.300.0080.00016.43
7.3.290.0000.01516.51
7.3.280.0080.00816.55
7.3.270.0060.01216.68
7.3.260.0040.01516.53
7.3.250.0080.01116.61
7.3.240.0060.01016.61
7.3.230.0120.00916.72
7.3.210.0130.01016.67
7.3.200.0100.00619.39
7.3.190.0060.01216.72
7.3.180.0060.00916.94
7.3.170.0130.00316.64
7.3.160.0140.00716.80
7.3.120.0060.00914.93
7.3.10.0080.00916.70
7.3.00.0070.01016.68
7.2.330.0030.01616.82
7.2.320.0060.00917.04
7.2.310.0200.01216.90
7.2.300.0120.00616.70
7.2.290.0040.01317.02
7.2.130.0040.00717.02
7.2.120.0110.00417.23
7.2.110.0030.01317.03
7.2.100.0060.00617.11
7.2.90.0090.00617.43
7.2.80.0090.00616.95
7.2.70.0120.00016.77
7.2.60.0080.00717.00
7.2.50.0000.01517.05
7.2.40.0100.00316.85
7.2.30.0090.00616.86
7.2.20.0060.00916.76
7.2.10.0030.01017.05
7.2.00.0090.00317.12
7.1.250.0040.00715.95
7.1.200.0000.01515.95
7.1.100.0060.00618.34
7.1.70.0040.00417.27
7.1.60.0110.01419.40
7.1.50.0100.01317.06
7.1.00.0070.05022.49
7.0.200.0300.00914.98
7.0.140.0030.07322.11
7.0.120.0000.08022.17
7.0.60.0170.07320.08
7.0.50.0000.04718.09
7.0.40.0000.08720.48
7.0.30.0370.07320.17
7.0.20.0300.08020.41
7.0.10.0200.05320.18
7.0.00.0030.06320.19
5.6.280.0030.07320.98
5.6.210.0070.07720.62
5.6.200.0130.07718.33
5.6.190.0100.07020.55
5.6.180.0200.04720.49
5.6.170.0230.04020.61
5.6.160.0070.05020.59
5.6.150.0030.05718.27
5.6.140.0130.04718.24
5.6.130.0100.03718.27
5.6.120.0130.07721.18
5.6.110.0130.07721.06
5.6.100.0030.04021.21
5.6.90.0130.07721.18
5.6.80.0030.08320.56
5.6.70.4430.03320.44
5.5.350.0270.08020.45
5.5.340.0070.04318.03
5.5.330.0030.09020.35
5.5.320.0230.07020.58
5.5.310.0200.05320.43
5.5.300.0030.07718.18
5.5.290.0100.06718.03
5.5.280.0170.07020.99
5.5.270.0100.05320.93
5.5.260.0000.04321.02
5.5.250.0030.06720.56
5.5.240.0130.08020.32
5.4.450.0000.05719.78
5.4.440.0000.08719.61
5.4.430.0070.06719.67
5.4.420.0000.07719.55
5.4.410.0100.07319.57
5.4.400.0100.06719.41
5.4.390.0200.05719.15
5.4.380.0070.05319.36
5.4.370.0070.04019.16
5.4.360.0100.07319.16
5.4.350.0070.04719.20
5.4.340.0000.05319.05
5.4.320.0070.05019.38
5.4.310.0030.04019.34
5.4.300.0100.06719.29
5.4.290.0130.07318.93
5.4.280.0030.05019.22
5.4.270.0070.04019.07
5.4.260.0030.04319.38
5.4.250.0070.07719.34
5.4.240.0100.04019.06
5.4.230.0130.07319.19
5.4.220.0030.06718.92
5.4.210.0100.04019.44
5.4.200.0000.04319.38
5.4.190.0130.05019.36
5.4.180.0070.05318.94
5.4.170.0030.08319.21
5.4.160.0070.04719.36
5.4.150.0070.04719.37
5.4.140.0030.04316.57
5.4.130.0030.06716.59
5.4.120.0030.03716.55
5.4.110.0070.03316.60
5.4.100.0000.04016.43
5.4.90.0030.08016.54
5.4.80.0070.06316.51
5.4.70.0070.04016.41
5.4.60.0030.03716.50
5.4.50.0100.07316.55
5.4.40.0070.03716.39
5.4.30.0100.04316.53
5.4.20.0070.03316.49
5.4.10.0070.04316.59
5.4.00.0100.06315.93
5.3.290.0070.03714.75
5.3.280.0000.04714.60
5.3.270.0100.06014.68
5.3.260.0070.07714.62
5.3.250.0100.07014.64
5.3.240.0070.07014.66
5.3.230.0030.07014.66
5.3.220.0000.04314.61
5.3.210.0100.06714.65
5.3.200.0070.06714.59
5.3.190.0030.04714.50
5.3.180.0070.04314.63
5.3.170.0130.05014.64
5.3.160.0000.04314.64
5.3.150.0070.03714.59
5.3.140.0070.07714.60
5.3.130.0070.04014.62
5.3.120.0070.03714.61
5.3.110.0100.03314.50
5.3.100.0070.04014.11
5.3.90.0070.05314.09
5.3.80.0030.05713.97
5.3.70.0070.05014.02
5.3.60.0030.05313.98
5.3.50.0000.08014.03
5.3.40.0070.05714.00
5.3.30.0130.03013.98
5.3.20.0070.04013.65
5.3.10.0030.04013.69
5.3.00.0030.07713.69
5.2.170.0070.06011.30
5.2.160.0000.04311.30
5.2.150.0030.03711.13
5.2.140.0070.06711.16
5.2.130.0070.03311.11
5.2.120.0030.04711.18
5.2.110.0030.03311.16
5.2.100.0030.03711.12
5.2.90.0030.03011.06
5.2.80.0070.02711.16
5.2.70.0070.04311.16
5.2.60.0070.05011.23
5.2.50.0000.06311.09
5.2.40.0070.06310.89
5.2.30.0000.04710.95
5.2.20.0000.07010.93
5.2.10.0030.06010.87
5.2.00.0070.05310.88
5.1.60.0030.0539.98
5.1.50.0100.05010.07
5.1.40.0070.0479.98
5.1.30.0070.05010.34
5.1.20.0130.04010.33
5.1.10.0030.05710.23
5.1.00.0030.03310.13
5.0.50.0030.0478.56
5.0.40.0070.0178.43
5.0.30.0030.0578.20
5.0.20.0070.0278.28
5.0.10.0000.0508.15
5.0.00.0070.0438.08
4.4.90.0030.0207.80
4.4.80.0030.0377.80
4.4.70.0030.0307.80
4.4.60.0030.0237.80
4.4.50.0030.0237.80
4.4.40.0030.0307.80
4.4.30.0000.0377.80
4.4.20.0000.0337.80
4.4.10.0000.0377.80
4.4.00.0000.0407.80
4.3.110.0000.0407.80
4.3.100.0000.0207.80
4.3.90.0000.0237.80
4.3.80.0030.0277.80
4.3.70.0000.0377.80
4.3.60.0070.0177.80
4.3.50.0000.0407.80
4.3.40.0030.0407.80
4.3.30.0030.0307.80
4.3.20.0000.0237.80
4.3.10.0000.0177.80
4.3.00.0000.0177.80

preferences:
44.22 ms | 401 KiB | 5 Q