3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<'XML' <nitf:body.content xmlns:nitf="foo"> <nitf:block> <nitf:p style="@style1">Contents of paragraph1.</nitf:p> <nitf:p style="@style2">Contents of paragraph2.</nitf:p> <nitf:p style="@style1"><nitf:em class="@bold">This is bold</nitf:em> This is not bold</nitf:p> <nitf:p style="@style1"><nitf:em class="@italic">This is italic</nitf:em> This is not italic</nitf:p> </nitf:block> </nitf:body.content> XML; $nitfNS = "foo"; $doc = new DOMDocument(); $doc->loadXML($xml); foreach($doc->getElementsByTagNameNS($nitfNS, 'em') as $em) { $class = $em->getAttribute('class'); if ($class == '@italic') { $em->nodeValue = '<i>' . $em->nodeValue . '</i>'; } elseif (strpos($class, 'bold') !== FALSE) { $em->nodeValue = '<b>' . $em->nodeValue . '</b>'; } echo $doc->saveXML($em), "\n"; } foreach ($doc->getElementsByTagNameNS($nitfNS, 'p') as $element) { $textnode = $element->childNodes->item(0); echo $textnode->textContent, "\n"; } echo $doc->saveXML();

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.0150.00617.25
8.3.50.0080.00816.97
8.3.40.0070.00719.07
8.3.30.0170.00319.13
8.3.20.0080.00020.52
8.3.10.0000.00823.86
8.3.00.0070.00322.65
8.2.180.0000.01525.92
8.2.170.0120.00619.13
8.2.160.0030.01422.96
8.2.150.0030.00525.66
8.2.140.0040.00424.66
8.2.130.0040.00422.46
8.2.120.0040.01126.16
8.2.110.0030.00722.42
8.2.100.0120.00017.97
8.2.90.0000.00818.00
8.2.80.0030.00618.41
8.2.70.0030.00618.18
8.2.60.0040.00418.47
8.2.50.0040.00418.10
8.2.40.0030.00620.72
8.2.30.0000.00819.65
8.2.20.0070.00017.95
8.2.10.0040.00418.53
8.2.00.0000.00818.10
8.1.280.0170.00325.92
8.1.270.0050.00324.66
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0070.00319.34
8.1.230.0070.00419.35
8.1.220.0060.00317.91
8.1.210.0050.00318.77
8.1.200.0080.00417.25
8.1.190.0040.00417.61
8.1.180.0040.00418.10
8.1.170.0060.00318.84
8.1.160.0000.00722.39
8.1.150.0000.00819.10
8.1.140.0030.00519.83
8.1.130.0000.00817.96
8.1.120.0040.00417.77
8.1.110.0000.00717.72
8.1.100.0040.00417.73
8.1.90.0030.00717.61
8.1.80.0000.00717.59
8.1.70.0100.00017.73
8.1.60.0030.00617.73
8.1.50.0060.00317.73
8.1.40.0030.00917.84
8.1.30.0000.00817.78
8.1.20.0040.00417.96
8.1.10.0000.00817.85
8.1.00.0050.00317.88
8.0.300.0080.00019.90
8.0.290.0040.00417.00
8.0.280.0040.00418.72
8.0.270.0020.00517.54
8.0.260.0000.00617.55
8.0.250.0000.00717.22
8.0.240.0060.00317.15
8.0.230.0040.00417.19
8.0.220.0070.00017.23
8.0.210.0040.00417.09
8.0.200.0000.00717.30
8.0.190.0000.00817.33
8.0.180.0040.00417.14
8.0.170.0080.00017.27
8.0.160.0040.00417.38
8.0.150.0040.00417.07
8.0.140.0040.00417.10
8.0.130.0030.00313.58
8.0.120.0000.00717.07
8.0.110.0000.00817.25
8.0.100.0020.00517.11
8.0.90.0040.00417.31
8.0.80.0070.00817.16
8.0.70.0040.00417.23
8.0.60.0070.00017.25
8.0.50.0040.00417.30
8.0.30.0110.00717.28
8.0.20.0110.00917.53
8.0.10.0040.00417.39
8.0.00.0130.01017.07
7.4.330.0030.00315.40
7.4.320.0030.00316.80
7.4.300.0060.00016.78
7.4.290.0070.00016.80
7.4.280.0030.00516.79
7.4.270.0070.00016.90
7.4.260.0060.00316.75
7.4.250.0070.00016.77
7.4.240.0060.00316.64
7.4.230.0000.00816.66
7.4.220.0120.01216.82
7.4.210.0110.00416.88
7.4.200.0050.00316.96
7.4.160.0030.01316.77
7.4.150.0060.01117.40
7.4.140.0150.00617.86
7.4.130.0080.00916.83
7.4.120.0130.00516.89
7.4.110.0030.01316.63
7.4.100.0110.00616.95
7.4.90.0100.01316.80
7.4.80.0090.00919.39
7.4.70.0120.00616.80
7.4.60.0100.00616.80
7.4.50.0030.01316.86
7.4.40.0030.01316.64
7.4.30.0130.00416.93
7.4.10.0070.01115.15
7.4.00.0070.01015.15
7.3.330.0060.00013.50
7.3.320.0000.00613.49
7.3.310.0040.00416.68
7.3.300.0000.00816.71
7.3.290.0090.01016.63
7.3.280.0060.01116.64
7.3.270.0110.00717.40
7.3.260.0150.00616.65
7.3.250.0110.01116.77
7.3.240.0060.01316.73
7.3.230.0040.01316.65
7.3.210.0100.00716.90
7.3.200.0090.00616.60
7.3.190.0140.00316.57
7.3.180.0070.01016.61
7.3.170.0170.00316.72
7.3.160.0070.01516.66
7.3.130.0070.01115.29
7.3.120.0100.00614.90
7.3.110.0080.00915.02
7.3.100.0030.01214.94
7.3.90.0050.00914.91
7.3.80.0050.01314.96
7.3.70.0080.00715.02
7.3.60.0020.01114.88
7.3.50.0070.00614.96
7.3.40.0070.00614.99
7.3.30.0100.00514.83
7.3.20.0110.00216.85
7.3.10.0050.01016.71
7.3.00.0040.00716.83
7.2.330.0120.00617.04
7.2.320.0100.00716.86
7.2.310.0120.01217.03
7.2.300.0140.00317.07
7.2.290.0120.00916.75
7.2.260.0040.01215.32
7.2.250.0070.01315.17
7.2.240.0060.00815.15
7.2.230.0080.00815.34
7.2.220.0040.00715.39
7.2.210.0060.00415.08
7.2.200.0050.00815.25
7.2.190.0030.01215.11
7.2.180.0050.00715.10
7.2.170.0080.00815.21
7.2.160.0030.00915.13
7.2.150.0050.00716.99
7.2.140.0060.00917.03
7.2.130.0030.00817.04
7.2.120.0050.01017.06
7.2.110.0080.00817.18
7.2.100.0100.00517.07
7.2.90.0020.00916.96
7.2.80.0070.00917.05
7.2.70.0090.00817.23
7.2.60.0050.00617.04
7.2.50.0050.01017.16
7.2.40.0050.01017.17
7.2.30.0070.00717.32
7.2.20.0080.00617.13
7.2.10.0040.00717.08
7.2.00.0040.01117.87
7.1.330.0050.00915.77
7.1.320.0080.00316.00
7.1.310.0060.00915.96
7.1.300.0110.00215.80
7.1.290.0030.00816.05
7.1.280.0050.00815.87
7.1.270.0060.00815.86
7.1.260.0050.01015.96
7.1.250.0030.00815.83
7.1.240.0110.00416.08
7.1.230.0000.01415.94
7.1.220.0070.01015.76
7.1.210.0070.00415.91
7.1.200.0050.00916.05
7.1.190.0000.01315.89
7.1.180.0080.01115.77
7.1.170.0000.01116.04
7.1.160.0030.01415.93
7.1.150.0100.00715.94
7.1.140.0110.00315.85
7.1.130.0060.00915.87
7.1.120.0040.00715.94
7.1.110.0050.00315.94
7.1.100.0030.01316.13
7.1.90.0060.00715.92
7.1.80.0000.01515.94
7.1.70.0050.00816.71
7.1.60.0100.00716.36
7.1.50.0040.00716.07
7.1.40.0070.00715.64
7.1.30.0070.00715.98
7.1.20.0060.00915.99
7.1.10.0000.01116.08
7.1.00.0050.04019.28
7.0.330.0060.01015.45
7.0.320.0120.00315.69
7.0.310.0030.01215.50
7.0.300.0130.00015.67
7.0.290.0100.00715.59
7.0.280.0000.01415.63
7.0.270.0090.00015.66
7.0.260.0060.00615.66
7.0.250.0030.00815.45
7.0.240.0070.00715.71
7.0.230.0100.00315.63
7.0.220.0060.00915.64
7.0.210.0000.01215.50
7.0.200.0170.00915.08
7.0.190.0000.01515.54
7.0.180.0030.01015.42
7.0.170.0080.00415.57
7.0.160.0000.01215.37
7.0.150.0040.00415.57
7.0.140.0030.01315.64
7.0.130.0110.00315.52
7.0.120.0090.00015.45
7.0.110.0030.03517.83
7.0.100.0100.04017.88
7.0.90.0150.03617.87
7.0.80.0100.03317.77
7.0.70.0080.03217.83
7.0.60.0250.03517.78
7.0.50.0180.03618.13
7.0.40.0330.03016.88
7.0.30.0230.03216.96
7.0.20.0130.03616.91
7.0.10.0200.03516.93
7.0.00.0210.03116.99
5.6.400.0090.00014.91
5.6.390.0090.00614.71
5.6.380.0070.00314.62
5.6.370.0150.00614.61
5.6.360.0030.01314.43
5.6.350.0030.00914.87
5.6.340.0040.00814.32
5.6.330.0080.00414.93
5.6.320.0040.01114.83
5.6.310.0040.00714.99
5.6.300.0000.01014.33
5.6.290.0040.01114.79
5.6.280.0070.01014.64
5.6.270.0040.00714.32
5.6.260.0070.03017.51
5.6.250.0100.03217.79
5.6.240.0060.03117.59
5.6.230.0050.04517.60
5.6.220.0070.03117.66
5.6.210.0090.03417.70
5.6.200.0080.03517.84
5.6.190.0080.03417.78
5.6.180.0100.03217.98
5.6.170.0090.03717.87
5.6.160.0050.03817.97
5.6.150.0100.03017.80
5.6.140.0120.03518.11
5.6.130.0120.03017.75
5.6.120.0050.03617.89
5.6.110.0080.03317.95
5.6.100.0030.03617.84
5.6.90.0080.03217.91
5.6.80.0050.03317.36
5.6.70.0080.02917.63
5.6.60.0080.02817.46
5.6.50.0090.03017.56
5.6.40.0080.02817.48
5.6.30.0060.03317.43
5.6.20.0080.03017.45
5.6.10.0110.02717.65
5.6.00.0080.03117.51

preferences:
65.47 ms | 400 KiB | 5 Q