3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xmlns = 'urn:foo'; $dom = new DOMDocument(); /* On the root level the prefix is replaced by default and the namespace for the attribute is lost */ $root = $dom->createElementNS($xmlns, 'element'); $root->setAttributeNS($xmlns, 'foo:attribute', 'bar'); $dom->appendChild($root); /* On the second level the prefix is replaced, the namespace declaration is duplicated and the element gets a prefix that was never provided. */ $child = $dom->createElementNS($xmlns, 'element'); $child->setAttributeNS($xmlns, 'foo:attribute', 'bar'); $root->appendChild($child); /* On the third level the prefix is replaced and the element gets a prefix again. */ $subchild = $dom->createElementNS($xmlns, 'element'); $subchild->setAttributeNS($xmlns, 'foo:attribute', 'bar'); $child->appendChild($subchild); /* If you add the element node before setting the attribute it gets no prefix */ $child = $dom->createElementNS($xmlns, 'element'); $root->appendChild($child); $child->setAttributeNS($xmlns, 'foo:attribute', 'bar'); $dom->formatOutput = TRUE; echo $dom->saveXml(); /* Expected <?xml version="1.0"?> <element xmlns="urn:foo" xmlns:foo="urn:foo" foo:attribute="bar"> <element foo:attribute="bar"> <element foo:attribute="bar"/> </element> <element foo:attribute="bar"/> </element> */

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.01418.56
8.3.50.0090.00722.03
8.3.40.0140.00419.09
8.3.30.0140.01119.21
8.3.20.0050.00320.45
8.3.10.0040.00422.25
8.3.00.0040.00422.71
8.2.180.0090.00618.41
8.2.170.0090.00922.96
8.2.160.0130.00022.41
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0000.00726.16
8.2.120.0070.00417.88
8.2.110.0060.00322.36
8.2.100.0040.00818.03
8.2.90.0040.00419.30
8.2.80.0050.00318.05
8.2.70.0060.00317.75
8.2.60.0030.00618.05
8.2.50.0050.00318.07
8.2.40.0070.00018.34
8.2.30.0040.00418.21
8.2.20.0000.00717.77
8.2.10.0040.00419.54
8.2.00.0040.00417.89
8.1.280.0080.00825.92
8.1.270.0030.00522.26
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0030.00624.00
8.1.230.0070.00319.28
8.1.220.0040.00417.90
8.1.210.0000.00818.77
8.1.200.0090.00017.60
8.1.190.0050.00317.65
8.1.180.0070.00318.10
8.1.170.0050.00318.59
8.1.160.0080.00022.16
8.1.150.0040.00418.79
8.1.140.0040.00417.55
8.1.130.0030.00318.01
8.1.120.0070.00017.50
8.1.110.0000.00717.63
8.1.100.0000.00717.61
8.1.90.0030.00617.42
8.1.80.0080.00017.51
8.1.70.0030.00317.65
8.1.60.0070.00317.63
8.1.50.0050.00317.69
8.1.40.0000.00817.58
8.1.30.0070.00017.75
8.1.20.0000.00917.76
8.1.10.0050.00317.83
8.1.00.0040.00417.77
8.0.300.0070.00018.77
8.0.290.0040.00417.29
8.0.280.0090.00018.57
8.0.270.0040.00417.37
8.0.260.0030.00316.94
8.0.250.0070.00017.06
8.0.240.0030.00717.07
8.0.230.0070.00016.96
8.0.220.0070.00017.03
8.0.210.0030.00316.90
8.0.200.0000.00617.12
8.0.190.0000.00816.98
8.0.180.0050.00316.96
8.0.170.0080.00017.13
8.0.160.0080.00016.90
8.0.150.0040.00416.96
8.0.140.0000.00717.06
8.0.130.0030.00613.57
8.0.120.0000.00817.06
8.0.110.0000.00717.05
8.0.100.0030.00516.89
8.0.90.0000.00716.90
8.0.80.0060.01217.09
8.0.70.0000.00816.91
8.0.60.0040.00416.95
8.0.50.0000.00817.03
8.0.30.0100.00917.23
8.0.20.0110.00917.40
8.0.10.0050.00217.01
8.0.00.0110.01116.76
7.4.330.0070.00015.00
7.4.320.0030.00316.54
7.4.300.0030.00316.58
7.4.290.0000.00716.65
7.4.280.0000.00716.69
7.4.270.0070.00016.80
7.4.260.0000.00716.81
7.4.250.0040.00416.79
7.4.240.0030.00416.68
7.4.230.0030.00316.44
7.4.220.0070.01016.59
7.4.210.0120.00516.67
7.4.200.0040.00416.60
7.4.190.0030.00516.70
7.4.160.0070.01016.47
7.4.150.0070.01317.40
7.4.140.0090.00917.86
7.4.130.0060.01216.67
7.4.120.0060.01516.63
7.4.110.0070.01016.49
7.4.100.0110.01116.81
7.4.90.0060.01116.78
7.4.80.0060.01219.39
7.4.70.0070.01016.57
7.4.60.0110.01116.74
7.4.50.0040.00416.55
7.4.40.0030.01222.77
7.4.30.0080.00816.79
7.4.00.0060.00614.66
7.3.330.0000.00513.29
7.3.320.0060.00013.13
7.3.310.0000.00716.25
7.3.300.0000.00716.24
7.3.290.0100.01116.46
7.3.280.0090.01016.40
7.3.270.0160.00317.40
7.3.260.0160.00316.71
7.3.250.0110.00616.60
7.3.240.0070.01016.63
7.3.230.0110.00616.75
7.3.210.0110.00816.50
7.3.200.0100.00719.39
7.3.190.0060.01216.48
7.3.180.0130.00316.66
7.3.170.0120.00416.93
7.3.160.0000.01516.77
7.3.120.0100.00715.02
7.3.10.0030.01016.68
7.3.00.0100.00316.71
7.2.330.0150.00816.85
7.2.320.0060.01316.50
7.2.310.0170.00016.77
7.2.300.0100.00716.54
7.2.290.0110.00616.93
7.2.130.0110.00616.96
7.2.120.0040.01217.00
7.2.110.0040.01217.06
7.2.100.0040.00817.00
7.2.90.0070.00717.02
7.2.80.0000.01816.86
7.2.70.0000.01117.03
7.2.60.0100.00316.97
7.2.50.0030.01016.88
7.2.40.0070.00317.13
7.2.30.0060.00916.95
7.2.20.0120.00316.84
7.2.10.0070.00716.85
7.2.00.0090.00618.21
7.1.250.0100.00015.92
7.1.200.0040.01115.80
7.1.100.0000.01118.05
7.1.70.0030.00717.20
7.1.60.0070.00419.82
7.1.50.0070.01616.91
7.1.00.0070.07322.61
7.0.200.0030.01216.75
7.0.140.0100.06722.05
7.0.60.0200.06719.95
7.0.50.0000.08317.93
7.0.40.0070.08020.12
7.0.30.0530.05720.09
7.0.20.0270.04320.39
7.0.10.0270.04020.19
7.0.00.0100.07720.22
5.6.280.0030.07320.81
5.6.210.0070.04320.73
5.6.200.0070.09018.18
5.6.190.0100.03720.83
5.6.180.0300.04020.81
5.6.170.0300.04320.48
5.6.160.0100.04720.68
5.6.150.0100.07318.25
5.6.140.0100.05018.21
5.6.130.0100.08318.28
5.6.120.0030.04321.18
5.6.110.0070.05721.05
5.6.100.0100.07321.16
5.6.90.0130.04021.04
5.6.80.0130.07720.44
5.5.350.0300.07020.33
5.5.340.0100.06718.08
5.5.330.0130.06020.31
5.5.320.0270.06320.28
5.5.310.0230.04020.23
5.5.300.0070.08018.07
5.5.290.0070.07318.05
5.5.280.0070.05321.01
5.5.270.0030.06320.76
5.5.260.0070.05720.93
5.5.250.0030.08020.81
5.5.240.0200.05020.15
5.4.450.0030.04319.25
5.4.440.1970.04719.65
5.4.430.1800.03719.27
5.4.420.1770.04719.56
5.4.410.2170.04319.50
5.4.400.1730.03718.91
5.4.390.1700.04019.15
5.4.380.0070.04319.14
5.4.370.0030.04318.93
5.4.360.0030.04019.28
5.4.350.0070.03719.19
5.4.340.0100.04718.92
5.4.320.0070.03319.15
5.4.310.0070.03719.22
5.4.300.0070.04318.97
5.4.290.0030.03719.30
5.4.280.0100.03019.12
5.4.270.0000.04019.14
5.4.260.0930.03719.16
5.4.250.1500.04318.97
5.4.240.2070.05319.15
5.4.230.0200.04319.14
5.4.220.0100.04019.17
5.4.210.0130.03718.89
5.4.200.0070.04319.21
5.4.190.0070.07718.92
5.4.180.0130.03719.29
5.4.170.0100.07019.21
5.4.160.0270.05719.13
5.4.150.1830.03719.20
5.4.140.1830.03716.43
5.4.130.0000.04316.42
5.4.120.0000.03716.38
5.4.110.0130.06016.52
5.4.100.0000.06316.56
5.4.90.0070.04016.41
5.4.80.0430.04316.52
5.4.70.0030.06316.53
5.4.60.0030.03316.59
5.4.50.1130.04016.42
5.4.40.0000.04716.42
5.4.30.0000.03716.32
5.4.20.1070.03316.42
5.4.10.1770.03716.26
5.4.00.0030.04315.84
5.3.290.0070.04314.68
5.3.280.0000.04014.71
5.3.270.1600.03314.63
5.3.260.0000.04014.52
5.3.250.0070.05714.62
5.3.240.0100.03314.53
5.3.230.1530.04014.71
5.3.220.0030.05714.54
5.3.210.0070.04014.73
5.3.200.0500.07314.44
5.3.190.0130.06014.59
5.3.180.0230.04014.65
5.3.170.0200.04014.73
5.3.160.0130.05714.53
5.3.150.0170.05014.68
5.3.140.0030.05014.57
5.3.130.0000.04714.46
5.3.120.0070.04714.63
5.3.110.0230.04714.57
5.3.100.0200.06314.00
5.3.90.0070.03313.97
5.3.80.0030.03714.04
5.3.70.0130.04014.08
5.3.60.0200.03014.02
5.3.50.0130.03713.96
5.3.40.0200.04313.81
5.3.30.0130.03713.98
5.3.20.0170.05013.54
5.3.10.0200.04013.52
5.3.00.0130.03313.52
5.2.170.0100.03311.38
5.2.160.0170.03311.23
5.2.150.0070.03711.16
5.2.140.0130.04711.32
5.2.130.0070.03311.04
5.2.120.0000.03311.13
5.2.110.0130.04011.08
5.2.100.0030.03311.30
5.2.90.0030.02711.26
5.2.80.0030.02711.18
5.2.70.0430.03011.32
5.2.60.0030.03011.07
5.2.50.0000.03711.03
5.2.40.0070.04011.07
5.2.30.0030.03710.90
5.2.20.0900.03010.88
5.2.10.0030.06310.87
5.2.00.0030.05010.80
5.1.60.0070.02010.03
5.1.50.0970.0309.97
5.1.40.1170.02310.05
5.1.30.2100.01710.46
5.1.20.1400.03310.54
5.1.10.0000.02710.05
5.1.00.0000.03010.04
5.0.50.0030.0238.86
5.0.40.0000.0408.86
5.0.30.0030.0478.86
5.0.20.0170.0238.86
5.0.10.0600.0178.86
5.0.00.0670.0378.86
4.4.90.0030.0308.86
4.4.80.0000.0338.86
4.4.70.0030.0138.86
4.4.60.0000.0208.86
4.4.50.0070.0308.86
4.4.40.0000.0438.86
4.4.30.0030.0178.86
4.4.20.0000.0408.86
4.4.10.0530.0178.86
4.4.00.0000.0238.86
4.3.110.0030.0378.86
4.3.100.0000.0138.86
4.3.90.0000.0278.86
4.3.80.0000.0378.86
4.3.70.0070.0308.86
4.3.60.0030.0208.86
4.3.50.0030.0178.86
4.3.40.0570.0378.86
4.3.30.0300.0208.86
4.3.20.0370.0178.86
4.3.10.0300.0208.86
4.3.00.0330.0278.86

preferences:
38.03 ms | 401 KiB | 5 Q