3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * The only reliable way of determining if a child exists * in SimpleXMLElement is to use count(). All other methods * do not work reliably in global or local NS. * * NOTE: Error suppresion on @count() is used to suppress * "PHP Warning: count(): Node no longer exists" */ if(!class_exists('SimpleXMLElement')) die("Bonkers"); $xml = new SimpleXMLElement(' <xml xmlns:abstract="urn:my.org:abstract"> <abstract:node>foo</abstract:node> <bar>123</bar> </xml> '); var_dump(gettype($xml->node)); var_dump(isset($xml->node)); var_dump(empty($xml->node)); var_dump(is_null($xml->node)); var_dump(($xml->node->count())); var_dump(@count($xml->node->children())); var_dump($xml->node->children()->count()); echo "----------------------\n"; var_dump(gettype($xml->bar)); var_dump(isset($xml->bar)); var_dump(empty($xml->bar)); var_dump(is_null($xml->bar)); var_dump(($xml->bar->count())); var_dump(@count($xml->bar->children())); var_dump($xml->bar->children()->count()); echo "----------------------\n";

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.0070.01118.93
8.3.50.0220.00821.37
8.3.40.0120.00318.79
8.3.30.0060.00918.95
8.3.20.0000.00720.46
8.3.10.0040.00423.96
8.3.00.0040.00420.04
8.2.180.0120.00316.88
8.2.170.0120.00322.96
8.2.160.0110.00420.64
8.2.150.0030.00524.18
8.2.140.0030.00624.66
8.2.130.0090.00026.16
8.2.120.0040.00417.75
8.2.110.0030.00719.52
8.2.100.0070.00618.09
8.2.90.0080.00019.34
8.2.80.0050.00317.97
8.2.70.0080.00317.75
8.2.60.0000.00818.05
8.2.50.0060.00318.07
8.2.40.0030.00519.30
8.2.30.0040.00420.01
8.2.20.0000.00817.81
8.2.10.0040.00418.36
8.2.00.0000.00718.29
8.1.280.0040.01225.92
8.1.270.0190.00020.45
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0000.00822.39
8.1.230.0110.00019.11
8.1.220.0040.00417.91
8.1.210.0040.00418.77
8.1.200.0070.00317.60
8.1.190.0030.00617.48
8.1.180.0090.00018.10
8.1.170.0080.00018.70
8.1.160.0000.00722.16
8.1.150.0030.00519.11
8.1.140.0030.00617.52
8.1.130.0020.00517.96
8.1.120.0040.00317.71
8.1.110.0040.00417.64
8.1.100.0070.00017.73
8.1.90.0070.00017.63
8.1.80.0040.00417.73
8.1.70.0000.00817.63
8.1.60.0020.00517.82
8.1.50.0030.00517.63
8.1.40.0040.00417.63
8.1.30.0030.00517.91
8.1.20.0040.00417.90
8.1.10.0080.00017.70
8.1.00.0070.00017.75
8.0.300.0000.00718.77
8.0.290.0050.00316.88
8.0.280.0040.00418.68
8.0.270.0000.00717.53
8.0.260.0060.00017.42
8.0.250.0000.00717.27
8.0.240.0030.00317.09
8.0.230.0060.00317.26
8.0.220.0030.00717.20
8.0.210.0050.00217.14
8.0.200.0000.00717.12
8.0.190.0080.00317.15
8.0.180.0040.00417.25
8.0.170.0090.00017.21
8.0.160.0040.00417.16
8.0.150.0030.00517.09
8.0.140.0040.00417.06
8.0.130.0080.00013.50
8.0.120.0080.00017.01
8.0.110.0050.00217.23
8.0.100.0000.00717.10
8.0.90.0030.00517.13
8.0.80.0120.00917.07
8.0.70.0030.00617.02
8.0.60.0040.00417.08
8.0.50.0070.00017.09
8.0.30.0060.01117.28
8.0.20.0060.01417.41
8.0.10.0080.00017.36
8.0.00.0110.00816.92
7.4.330.0030.00315.20
7.4.320.0000.00716.68
7.4.300.0030.00316.75
7.4.290.0090.00016.73
7.4.280.0000.00816.63
7.4.270.0000.00716.75
7.4.260.0000.00716.80
7.4.250.0090.00016.72
7.4.240.0070.00216.75
7.4.230.0030.00416.88
7.4.220.0100.00716.69
7.4.210.0000.01416.71
7.4.200.0000.00716.83
7.4.160.0040.01216.76
7.4.150.0060.01417.40
7.4.140.0090.00917.86
7.4.130.0140.00916.69
7.4.120.0110.00716.76
7.4.110.0090.01216.81
7.4.100.0080.01116.82
7.4.90.0160.00016.86
7.4.80.0130.00319.39
7.4.70.0060.01116.75
7.4.60.0150.00316.61
7.4.50.0030.00516.80
7.4.40.0100.01016.71
7.4.30.0100.01416.77
7.4.00.0080.00815.14
7.3.330.0000.00513.32
7.3.320.0050.00013.20
7.3.310.0000.00816.29
7.3.300.0000.00616.44
7.3.290.0060.00916.46
7.3.280.0110.00516.49
7.3.270.0120.00617.40
7.3.260.0180.00016.78
7.3.250.0110.00616.64
7.3.240.0040.01516.54
7.3.230.0030.01416.69
7.3.210.0030.01316.45
7.3.200.0060.00916.63
7.3.190.0120.00616.40
7.3.180.0080.00816.74
7.3.170.0080.00816.75
7.3.160.0070.01016.50
7.3.10.0040.00416.48
7.3.00.0080.00416.54
7.2.330.0090.00917.02
7.2.320.0140.00316.93
7.2.310.0120.00616.86
7.2.300.0110.00916.94
7.2.290.0060.01516.87
7.2.130.0030.00916.91
7.2.120.0060.00716.97
7.2.110.0040.00816.80
7.2.100.0030.01316.81
7.2.90.0040.00416.85
7.2.80.0060.00616.83
7.2.70.0060.00917.18
7.2.60.0070.00716.88
7.2.50.0120.00016.89
7.2.40.0120.00017.04
7.2.30.0050.00516.98
7.2.20.0030.00916.78
7.2.10.0100.00017.21
7.2.00.0040.00818.06
7.1.250.0000.00915.77
7.1.200.0030.01015.79
7.1.100.0030.01218.13
7.1.70.0050.00217.31
7.1.60.0070.00419.12
7.1.50.0120.00916.96
7.1.00.0030.07722.56
7.0.200.0090.00316.95
7.0.60.0030.07019.96
7.0.50.0000.06317.98
7.0.40.0100.04720.10
7.0.30.0570.07020.32
7.0.20.0200.03720.22
7.0.10.0030.04720.24
7.0.00.0070.03720.10
5.6.280.0100.06721.08
5.6.210.0000.06720.56
5.6.200.0030.05318.24
5.6.190.0030.06020.46
5.6.180.0300.07720.81
5.6.170.0200.03720.67
5.6.160.0100.03720.69
5.6.150.0070.03718.34
5.6.140.0030.04718.18
5.6.130.0030.08018.22
5.6.120.0070.07721.20
5.6.110.0200.07021.02
5.6.100.0000.04321.19
5.6.90.0130.03721.02
5.6.80.0130.07720.43
5.6.70.0230.07720.58
5.5.350.0330.07320.44
5.5.340.0100.08018.06
5.5.330.0100.03720.26
5.5.320.0430.05020.35
5.5.310.0330.08020.28
5.5.300.0030.08018.08
5.5.290.0130.07318.08
5.5.280.0100.08020.93
5.5.270.0130.06721.09
5.5.260.0030.05321.05
5.5.250.0070.06020.82
5.5.240.0170.02720.45
5.4.450.0500.06019.54
5.4.440.0500.06719.45
5.4.430.0570.06719.45
5.4.420.0600.04719.65
5.4.410.0630.04319.52
5.4.400.0630.05319.36
5.4.390.0630.04319.13
5.4.380.0570.05719.20
5.4.370.0570.05018.98
5.4.360.0700.06319.38
5.4.350.0530.05319.18
5.4.340.0500.06019.18
5.4.320.0600.04719.36
5.4.310.0530.05718.99
5.4.300.0570.05319.16
5.4.290.0570.04719.37
5.4.280.0630.04319.38
5.4.270.0430.06319.36
5.4.260.0600.04319.20
5.4.250.0600.05019.02
5.4.240.0570.05319.17
5.4.230.0630.05719.20
5.4.220.0670.05319.23
5.4.210.0900.05719.20
5.4.200.0800.04019.00
5.4.190.0600.04719.12
5.4.180.0700.05019.17
5.4.170.0670.05019.34
5.4.160.0730.04719.33
5.4.150.0700.05018.98
5.4.140.0700.04716.64
5.4.130.0600.05316.31
5.4.120.0630.05316.59
5.4.110.0700.04716.45
5.4.100.0700.04716.59
5.4.90.0700.04716.43
5.4.80.0470.06316.64
5.4.70.0230.05316.50
5.4.60.0330.06316.39
5.4.50.0070.06016.57
5.4.40.0000.06016.61
5.4.30.0030.03716.44
5.4.20.0030.06016.57

preferences:
70.43 ms | 401 KiB | 5 Q