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>'. ' <row4 ver="4.0">my test data</row4>'. ' </rows>'. ' </body>'. '</request>'; $obj = new MyXML($s); $row = $obj->firstChild()->firstChild()->row4; 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.40.0110.01119.16
8.3.30.0100.00320.63
8.3.20.0070.00720.57
8.3.10.0030.00521.28
8.3.00.0040.00422.56
8.2.170.0120.00322.96
8.2.160.0090.00619.21
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0000.00826.16
8.2.120.0050.00321.00
8.2.110.0040.00419.55
8.2.100.0090.00318.16
8.2.90.0060.00319.38
8.2.80.0050.00318.05
8.2.70.0000.00917.75
8.2.60.0120.00018.18
8.2.50.0040.00418.07
8.2.40.0050.00518.28
8.2.30.0040.00419.73
8.2.20.0040.00417.87
8.2.10.0040.00418.06
8.2.00.0040.00418.06
8.1.270.0060.00323.99
8.1.260.0080.00026.35
8.1.250.0000.00928.09
8.1.240.0030.00624.15
8.1.230.0070.00421.24
8.1.220.0090.00018.77
8.1.210.0070.00319.38
8.1.200.0050.00517.60
8.1.190.0000.00817.78
8.1.180.0030.00618.10
8.1.170.0040.00418.91
8.1.160.0070.00019.11
8.1.150.0030.00518.91
8.1.140.0040.00417.71
8.1.130.0060.00317.61
8.1.120.0040.00417.83
8.1.110.0030.00717.62
8.1.100.0040.00417.59
8.1.90.0040.00417.64
8.1.80.0000.00717.79
8.1.70.0030.00317.73
8.1.60.0030.00617.91
8.1.50.0030.00517.64
8.1.40.0000.00817.68
8.1.30.0080.00017.99
8.1.20.0050.00217.83
8.1.10.0000.00917.74
8.1.00.0080.00017.67
8.0.300.0040.00420.10
8.0.290.0000.00717.39
8.0.280.0000.00718.77
8.0.270.0030.00317.47
8.0.260.0000.00717.09
8.0.250.0030.00317.25
8.0.240.0000.00717.29
8.0.230.0030.00617.09
8.0.220.0040.00417.20
8.0.210.0030.00517.09
8.0.200.0070.00017.29
8.0.190.0030.00317.09
8.0.180.0070.00017.08
8.0.170.0040.00417.18
8.0.160.0070.00017.13
8.0.150.0040.00417.09
8.0.140.0080.00417.13
8.0.130.0000.00713.63
8.0.120.0040.00417.23
8.0.110.0040.00417.15
8.0.100.0060.00317.15
8.0.90.0040.00417.18
8.0.80.0130.00317.18
8.0.70.0040.00417.14
8.0.60.0000.00717.17
8.0.50.0040.00416.95
8.0.30.0120.00717.38
8.0.20.0160.00517.41
8.0.10.0040.00417.13
8.0.00.0050.01416.90
7.4.330.0030.00316.94
7.4.320.0000.00716.62
7.4.300.0000.00816.69
7.4.290.0070.00016.75
7.4.280.0070.00016.96
7.4.270.0050.00316.79
7.4.260.0000.00613.43
7.4.250.0030.00616.79
7.4.240.0020.00516.89
7.4.230.0000.00716.84
7.4.220.0030.01516.81
7.4.210.0090.00716.81
7.4.200.0030.00316.73
7.4.190.0080.00016.86
7.4.160.0000.01616.80
7.4.150.0090.00917.40
7.4.140.0090.00817.86
7.4.130.0070.01016.74
7.4.120.0120.00816.71
7.4.110.0110.00716.89
7.4.100.0090.00916.86
7.4.90.0170.00016.64
7.4.80.0160.00719.39
7.4.70.0140.00816.95
7.4.60.0000.01716.69
7.4.50.0000.00816.82
7.4.40.0000.01422.77
7.4.30.0140.00416.65
7.4.00.0060.01014.91
7.3.330.0050.00013.55
7.3.320.0000.00613.54
7.3.310.0030.00516.57
7.3.300.0030.00316.59
7.3.290.0000.01316.57
7.3.280.0090.00716.56
7.3.270.0070.01017.40
7.3.260.0120.00618.24
7.3.250.0100.00716.73
7.3.240.0030.01316.89
7.3.230.0160.00616.57
7.3.210.0040.01316.64
7.3.200.0160.00319.39
7.3.190.0070.01416.86
7.3.180.0110.01116.64
7.3.170.0110.00516.62
7.3.160.0060.01216.57
7.3.120.0030.01215.07
7.3.00.0070.00716.57
7.2.330.0130.00416.94
7.2.320.0150.00916.76
7.2.310.0140.00716.92
7.2.300.0060.01216.75
7.2.290.0100.00716.98
7.2.130.0030.00616.95
7.2.120.0070.00417.07
7.2.110.0070.00716.84
7.2.100.0060.00616.77
7.2.90.0000.01416.84
7.2.80.0000.01317.09
7.2.70.0060.00917.13
7.2.60.0000.00917.08
7.2.50.0060.00617.05
7.2.40.0030.00917.18
7.2.30.0000.01116.86
7.2.20.0110.00316.87
7.2.10.0000.01416.86
7.2.00.0090.00518.22
7.1.250.0000.01215.72
7.1.240.0030.01015.81
7.1.230.0100.00315.55
7.1.220.0050.00315.83
7.1.210.0030.01015.84
7.1.200.0040.00815.95
7.1.190.0070.00315.98
7.1.180.0080.00615.74
7.1.170.0060.00615.77
7.1.160.0030.00615.91
7.1.150.0040.00815.67
7.1.140.0070.00715.76
7.1.130.0070.00415.96
7.1.120.0070.01015.88
7.1.110.0000.01415.97
7.1.100.0110.00417.15
7.1.90.0030.01415.98
7.1.80.0030.00515.86
7.1.70.0080.00516.64
7.1.60.0100.00717.42
7.1.50.0070.01216.16
7.1.40.0100.00015.97
7.1.30.0030.00615.81
7.1.20.0040.00916.03
7.1.10.0030.00815.67
7.1.00.0020.03819.31
7.0.330.0030.00615.39
7.0.320.0050.00515.31
7.0.310.0030.01215.32
7.0.300.0040.00815.22
7.0.290.0060.00615.60
7.0.280.0000.01715.52
7.0.270.0060.00615.50
7.0.260.0030.01015.50
7.0.250.0110.00415.64
7.0.240.0120.00315.30
7.0.230.0000.01615.38
7.0.220.0060.00615.50
7.0.210.0030.01215.59
7.0.200.0170.00615.17
7.0.190.0040.01115.30
7.0.180.0110.00415.09
7.0.170.0110.00415.42
7.0.160.0070.00715.34
7.0.150.0060.00615.24
7.0.140.0020.04218.88
7.0.130.0070.00715.17
7.0.120.0090.00615.41
7.0.110.0090.00615.57
7.0.100.0070.00315.40
7.0.90.0030.01015.52
7.0.80.0070.00715.32
7.0.70.0070.00715.58
7.0.60.0070.02017.75
7.0.50.0050.04216.83
7.0.40.0080.04316.88
7.0.30.0280.04317.00
7.0.20.0230.03116.97
7.0.10.0080.04316.93
7.0.00.0080.03516.85
5.6.380.0080.00514.45
5.6.370.0030.00914.27
5.6.360.0100.00314.19
5.6.350.0000.01314.25
5.6.340.0070.00713.95
5.6.330.0100.00313.93
5.6.320.0080.00614.16
5.6.310.0070.00414.34
5.6.300.0060.00614.18
5.6.290.0040.01114.25
5.6.280.0030.04017.69
5.6.270.0060.00614.34
5.6.260.0110.00614.58
5.6.250.0000.01414.25
5.6.240.0030.01014.50
5.6.230.0060.00314.17
5.6.220.0060.00614.25
5.6.210.0070.04117.54
5.6.200.0050.03316.40
5.6.190.0080.03617.45
5.6.180.0240.03017.52
5.6.170.0200.03717.68
5.6.160.0000.03617.38
5.6.150.0050.02616.26
5.6.140.0030.04816.39
5.6.130.0080.04116.33
5.6.120.0020.04417.84
5.6.110.0080.04517.78
5.6.100.0050.02117.74
5.6.90.0050.04817.59
5.6.80.0050.02317.51
5.6.70.2020.02917.28
5.6.60.0040.00414.38
5.6.50.0040.00414.17
5.6.40.0040.00414.14
5.6.30.0000.01714.48
5.6.20.0000.00914.25
5.6.10.0060.00614.33
5.6.00.0030.01014.33
5.5.380.0030.00911.18
5.5.370.0130.00011.18
5.5.360.0040.01111.20
5.5.350.0080.04615.86
5.5.340.0030.03414.67
5.5.330.0030.02515.89
5.5.320.0180.02215.79
5.5.310.0220.03715.83
5.5.300.0100.03314.63
5.5.290.0080.04114.77
5.5.280.0030.04816.00
5.5.270.0020.02916.05
5.5.260.0110.03816.05
5.5.250.0070.04316.06
5.5.240.0000.04815.66
5.5.230.0030.01011.18
5.5.220.0030.00611.18
5.5.210.0090.00311.34
5.5.200.0030.00911.18
5.5.190.0000.01011.18
5.5.180.0030.00911.33
5.5.170.0030.00911.22
5.5.160.0030.00711.25
5.5.150.0030.00611.30
5.5.140.0040.00411.19
5.5.130.0030.00911.45
5.5.120.0090.00311.34
5.5.110.0070.00311.18
5.5.100.0000.00811.34
5.5.90.0070.00311.18
5.5.80.0050.00311.31
5.5.70.0090.00011.27
5.5.60.0000.00811.20
5.5.50.0000.00911.32
5.5.40.0070.00011.26
5.5.30.0030.00311.19
5.5.20.0030.00611.18
5.5.10.0050.00311.18
5.5.00.0030.00511.34
5.4.450.0070.03815.44
5.4.440.0080.03815.40
5.4.430.0080.03515.41
5.4.420.0000.04015.36
5.4.410.0000.02815.28
5.4.400.0040.03715.26
5.4.390.0000.04615.26
5.4.380.0050.03315.28
5.4.370.0050.04315.18
5.4.360.0050.04015.24
5.4.350.0020.03015.26
5.4.340.0040.04415.17
5.4.330.0070.00411.18
5.4.320.0040.04515.19
5.4.310.0050.02715.16
5.4.300.0040.04215.16
5.4.290.0030.04015.12
5.4.280.0040.02415.21
5.4.270.0030.04015.11
5.4.260.0030.02115.10
5.4.250.0050.03715.18
5.4.240.0080.03015.15
5.4.230.0040.02315.23
5.4.220.0040.02515.19
5.4.210.0060.03715.27
5.4.200.0060.03215.16
5.4.190.0050.03415.15
5.4.180.0070.03815.15
5.4.170.0030.04315.17
5.4.160.0040.03715.26
5.4.150.0070.03815.25
5.4.140.0050.03313.82
5.4.130.0020.02713.98
5.4.120.0030.02213.85
5.4.110.0060.02213.86
5.4.100.0020.03213.93
5.4.90.0050.03914.02
5.4.80.0030.03713.85
5.4.70.0010.02113.92
5.4.60.0030.03813.85
5.4.50.0050.03013.91
5.4.40.0080.02813.87
5.4.30.0030.03813.85
5.4.20.0050.03713.99
5.4.10.0060.03513.93
5.4.00.0030.03913.52
5.3.290.0090.04513.00
5.3.280.0090.01712.85
5.3.270.0040.02912.93
5.3.260.0030.02512.97
5.3.250.0080.03612.86
5.3.240.0050.02412.89
5.3.230.0050.02212.97
5.3.220.0030.03912.90
5.3.210.0040.03612.96
5.3.200.0000.03112.87
5.3.190.0020.02912.90
5.3.180.0040.04112.92
5.3.170.0050.02212.91
5.3.160.0050.03512.83
5.3.150.0040.02412.90
5.3.140.0050.03212.88
5.3.130.0080.02112.82
5.3.120.0050.03812.95
5.3.110.0030.04212.86
5.3.100.0050.04012.66
5.3.90.0040.03712.56
5.3.80.0020.03312.56
5.3.70.0060.03912.61
5.3.60.0030.03812.56
5.3.50.0090.03412.68
5.3.40.0050.02112.57
5.3.30.0030.04012.59
5.3.20.0050.03212.42
5.3.10.0000.03112.38
5.3.00.0040.02012.37
5.2.170.0060.02111.62
5.2.160.0050.02211.62
5.2.150.0050.01611.62
5.2.140.0040.03311.62
5.2.130.0020.02911.62
5.2.120.0030.02411.62
5.2.110.0050.01711.62
5.2.100.0020.01811.62
5.2.90.0030.03311.62
5.2.80.0070.02011.62
5.2.70.0050.03011.62
5.2.60.0030.03511.62
5.2.50.0030.03311.62
5.2.40.0050.02011.62
5.2.30.0050.01511.62
5.2.20.0030.01711.62
5.2.10.0020.03211.62
5.2.00.0000.03111.62
5.1.60.0030.01611.62
5.1.50.0020.01611.62
5.1.40.0040.01311.62
5.1.30.0060.02711.62
5.1.20.0010.03311.62
5.1.10.0000.02011.62
5.1.00.0030.01611.62
5.0.50.0000.02011.62
5.0.40.0010.02511.62
5.0.30.0020.02011.62
5.0.20.0050.02011.62
5.0.10.0000.02611.62
5.0.00.0020.03311.62
4.4.90.0020.01511.62
4.4.80.0020.02011.62
4.4.70.0000.01211.62
4.4.60.0020.01811.62
4.4.50.0020.01511.62
4.4.40.0000.02911.62
4.4.30.0040.00711.62
4.4.20.0030.01111.62
4.4.10.0020.01811.62
4.4.00.0010.01811.62
4.3.110.0000.01711.62
4.3.100.0070.01011.62
4.3.90.0000.01511.62
4.3.80.0010.02811.62
4.3.70.0010.01411.62
4.3.60.0020.01311.62
4.3.50.0020.01911.62
4.3.40.0010.01711.62
4.3.30.0000.02211.62
4.3.20.0040.01311.62
4.3.10.0000.01611.62
4.3.00.0040.01211.62

preferences:
42.63 ms | 400 KiB | 5 Q