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() { var_dump(count($this));exit; return (count); } 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(); var_dump($row->getChildrenKeys());

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.00816.88
8.3.50.0100.00817.72
8.3.40.0070.01418.96
8.3.30.0090.00618.95
8.3.20.0160.00318.82
8.3.10.0040.00420.78
8.3.00.0120.00619.63
8.2.180.0090.00616.88
8.2.170.0140.00422.96
8.2.160.0130.00720.60
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0110.00726.16
8.2.120.0040.00420.14
8.2.110.0030.00621.18
8.2.100.0090.00318.16
8.2.90.0060.00319.72
8.2.80.0060.00319.41
8.2.70.0030.00517.63
8.2.60.0030.00618.17
8.2.50.0080.00018.07
8.2.40.0050.00318.59
8.2.30.0000.00718.33
8.2.20.0020.00517.97
8.2.10.0000.00818.06
8.2.00.0090.00318.07
8.1.280.0110.00325.92
8.1.270.0040.00424.66
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0060.00322.84
8.1.230.0060.00621.22
8.1.220.0000.00818.00
8.1.210.0070.00419.16
8.1.200.0060.00317.60
8.1.190.0050.00517.79
8.1.180.0040.00418.10
8.1.170.0030.00519.28
8.1.160.0070.00019.21
8.1.150.0070.00018.89
8.1.140.0030.00717.59
8.1.130.0070.00017.98
8.1.120.0030.00317.59
8.1.110.0000.00717.72
8.1.100.0000.00817.55
8.1.90.0040.00417.61
8.1.80.0040.00417.79
8.1.70.0040.00417.61
8.1.60.0040.00417.71
8.1.50.0040.00417.79
8.1.40.0040.00417.80
8.1.30.0060.00317.80
8.1.20.0040.00417.84
8.1.10.0000.00817.76
8.1.00.0040.00417.66
8.0.300.0070.00020.36
8.0.290.0040.00417.00
8.0.280.0000.00718.71
8.0.270.0040.00417.53
8.0.260.0040.00417.10
8.0.250.0000.00717.12
8.0.240.0070.00417.14
8.0.230.0030.00317.16
8.0.220.0000.00717.17
8.0.210.0000.00717.11
8.0.200.0030.00317.27
8.0.190.0050.00217.29
8.0.180.0000.00717.06
8.0.170.0060.00317.08
8.0.160.0000.00717.11
8.0.150.0000.00817.23
8.0.140.0030.00617.18
8.0.130.0060.00013.55
8.0.120.0040.00417.15
8.0.110.0040.00417.08
8.0.100.0000.00717.08
8.0.90.0000.00717.07
8.0.80.0080.00717.20
8.0.70.0000.00817.13
8.0.60.0040.00417.22
8.0.50.0040.00417.10
8.0.30.0160.00717.53
8.0.20.0110.01117.21
8.0.10.0000.00717.30
8.0.00.0090.00917.20
7.4.330.0050.00013.33
7.4.320.0030.00316.89
7.4.300.0060.00016.78
7.4.290.0000.00716.93
7.4.280.0000.00716.88
7.4.270.0080.00016.70
7.4.260.0030.00313.53
7.4.250.0000.00916.95
7.4.240.0030.00316.73
7.4.230.0030.00516.85
7.4.220.0130.01316.86
7.4.210.0060.01016.74
7.4.200.0030.00316.68
7.4.190.0000.00716.88
7.4.160.0110.00516.72
7.4.150.0120.00616.77
7.4.140.0130.00916.69
7.4.130.0040.01316.90
7.4.120.0100.00716.77
7.4.110.0030.01316.81
7.4.100.0070.01016.62
7.4.90.0130.01016.75
7.4.80.0060.01016.85
7.4.70.0060.01616.67
7.4.60.0140.00716.92
7.4.50.0000.00516.71
7.4.40.0040.01116.66
7.4.30.0050.01016.83
7.4.00.0070.01015.05
7.3.330.0060.00013.39
7.3.320.0000.00613.61
7.3.310.0040.00416.59
7.3.300.0030.00316.43
7.3.290.0080.01216.59
7.3.280.0060.01016.53
7.3.270.0110.00616.87
7.3.260.0120.00616.77
7.3.250.0140.00616.67
7.3.240.0070.01016.48
7.3.230.0120.00616.57
7.3.210.0130.00416.82
7.3.200.0120.00819.39
7.3.190.0060.01316.55
7.3.180.0070.01216.95
7.3.170.0130.00916.86
7.3.160.0060.00916.57
7.3.120.0100.00714.98
7.3.110.0040.01315.06
7.3.100.0000.01414.80
7.3.90.0050.00815.10
7.3.80.0060.00615.04
7.3.70.0080.00514.80
7.3.60.0050.00514.93
7.3.50.0050.00514.89
7.3.40.0070.00915.12
7.3.30.0050.01114.95
7.3.20.0050.00916.88
7.3.10.0070.00716.79
7.3.00.0030.00816.86
7.2.330.0090.00817.02
7.2.320.0120.00916.99
7.2.310.0160.01016.66
7.2.300.0100.00716.63
7.2.290.0060.01116.73
7.2.250.0090.01115.32
7.2.240.0050.01215.29
7.2.230.0070.01015.13
7.2.220.0030.01015.37
7.2.210.0080.00815.16
7.2.200.0050.00915.18
7.2.190.0100.00615.23
7.2.180.0070.01015.18
7.2.170.0050.01115.27
7.2.00.0110.00719.57
7.1.330.0080.00615.74
7.1.320.0050.00815.87
7.1.310.0080.00515.95
7.1.300.0060.00915.98
7.1.290.0030.01015.87
7.1.280.0020.01115.84
7.1.270.0050.00715.77
7.1.260.0090.00515.97
7.1.100.0000.01118.33
7.1.70.0030.00717.07
7.1.60.0070.01519.40
7.1.50.0100.01616.89
7.1.00.0030.07722.61
7.0.200.0040.00416.91
7.0.140.0070.07322.20
7.0.120.0100.06722.13
7.0.60.0130.07019.96
7.0.50.0100.04717.93
7.0.40.0070.04020.22
7.0.30.0170.04320.20
7.0.20.0230.08020.31
7.0.10.0230.04720.40
7.0.00.0170.07320.22
5.6.280.0030.07320.98
5.6.210.0130.07320.54
5.6.200.0000.04718.33
5.6.190.0030.04720.55
5.6.180.0300.07020.76
5.6.170.0330.04720.54
5.6.160.0100.07720.64
5.6.150.0030.04018.29
5.6.140.0000.04318.40
5.6.130.0170.07318.19
5.6.120.0130.06021.11
5.6.110.0030.07721.24
5.6.100.0070.07321.01
5.6.90.0070.08321.20
5.6.80.0270.04720.41
5.6.70.0370.06320.43
5.5.350.0130.07020.47
5.5.340.0030.07318.16
5.5.330.0070.04020.64
5.5.320.0130.08320.61
5.5.310.0270.05720.49
5.5.300.0070.07318.02
5.5.290.0100.08018.05
5.5.280.0100.05720.82
5.5.270.0100.08321.07
5.5.260.0070.09020.93
5.5.250.0100.06720.72
5.5.240.0030.04020.46
5.4.450.0030.07319.65
5.4.440.0100.05719.46
5.4.430.0000.08319.71
5.4.420.0000.06719.55
5.4.410.0030.06719.30
5.4.400.0030.04319.32
5.4.390.0030.08019.03
5.4.380.0030.07719.14
5.4.370.0000.07319.13
5.4.360.0000.06319.30
5.4.350.0000.09019.05
5.4.340.0030.08019.36
5.4.320.0000.08719.16
5.4.310.0070.07319.23
5.4.300.0030.07319.07
5.4.290.0030.06019.29
5.4.280.0070.08019.32
5.4.270.0000.06019.07
5.4.260.0000.05319.13
5.4.250.0030.07019.37
5.4.240.0300.05319.16
5.4.230.0030.08019.22
5.4.220.0000.07719.34
5.4.210.0100.06319.13
5.4.200.0000.06019.38
5.4.190.0030.06019.28
5.4.180.0100.06719.06
5.4.170.0100.07319.17
5.4.160.0070.07319.11
5.4.150.0030.06319.12
5.4.140.0030.07016.54
5.4.130.0070.06716.46
5.4.120.0030.07016.54
5.4.110.0000.07716.69
5.4.100.0030.06016.53
5.4.90.0070.07316.58
5.4.80.0030.07716.65
5.4.70.0000.07316.49
5.4.60.0000.06316.61
5.4.50.0030.07016.66
5.4.40.0000.07316.66
5.4.30.0070.06316.55
5.4.20.0000.04716.67
5.4.10.0030.04316.70
5.4.00.0030.07016.09
5.3.290.0070.06714.89
5.3.280.0200.05014.80
5.3.270.0000.08014.80
5.3.260.0000.06314.80
5.3.250.0030.07314.80
5.3.240.0000.08014.80
5.3.230.0030.07714.80
5.3.220.0030.07314.80
5.3.210.0030.07714.80
5.3.200.0030.05314.80
5.3.190.0030.07014.80
5.3.180.0070.07714.80
5.3.170.0030.07014.80
5.3.160.0070.05714.80
5.3.150.0070.06714.80
5.3.140.0000.07014.80
5.3.130.0030.07314.80
5.3.120.0070.07314.80
5.3.110.0070.05314.80
5.3.100.0030.07014.80
5.3.90.0070.06314.80
5.3.80.0000.04314.80
5.3.70.0000.03714.80
5.3.60.0030.03314.80
5.3.50.0000.03714.80
5.3.40.0000.03714.80
5.3.30.0030.03314.80
5.3.20.0000.03314.80
5.3.10.0030.03714.80
5.3.00.0000.03314.80
5.2.170.0030.02714.80
5.2.160.0000.03014.80
5.2.150.0030.02714.80
5.2.140.0000.03314.80
5.2.130.0000.02714.80
5.2.120.0000.03014.80
5.2.110.0030.02714.80
5.2.100.0000.03014.80
5.2.90.0030.03014.80
5.2.80.0000.03014.80
5.2.70.0000.03014.80
5.2.60.0030.06314.80
5.2.50.0030.06014.80
5.2.40.0070.05014.80
5.2.30.0030.03014.80
5.2.20.0070.05714.80
5.2.10.0000.03014.80
5.2.00.0000.03314.80
5.1.60.0000.02714.80
5.1.50.0000.02714.80
5.1.40.0000.02714.80
5.1.30.0000.04314.80
5.1.20.0000.02714.80
5.1.10.0000.02314.80
5.1.00.0030.02314.80
5.0.50.0000.02014.80
5.0.40.0030.01714.80
5.0.30.0000.03014.80
5.0.20.0000.02014.80
5.0.10.0000.02014.80
5.0.00.0000.03314.80
4.4.90.0030.01314.80
4.4.80.0030.03314.80
4.4.70.0070.02014.80
4.4.60.0000.01714.80
4.4.50.0000.01314.80
4.4.40.0000.03714.80
4.4.30.0030.01314.80
4.4.20.0000.01314.80
4.4.10.0000.01314.80
4.4.00.0000.02714.80
4.3.110.0000.01714.80
4.3.100.0000.01714.80
4.3.90.0000.01714.80
4.3.80.0000.02314.80
4.3.70.0030.01314.80
4.3.60.0000.01314.80
4.3.50.0000.01714.80
4.3.40.0030.02314.80
4.3.30.0000.01714.80
4.3.20.0000.01714.80
4.3.10.0030.01314.80
4.3.00.0000.01314.80

preferences:
45.94 ms | 401 KiB | 5 Q