3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <body class="old_attr"> <div>(content)</div> </body> HTML; $new_class = "new_class_attr"; $dom=new DOMDocument; $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $body = $dom->getElementsByTagName('body')->item(0); if ($body->hasAttribute("class")) { $new_class = $body->getAttribute("class") . " " . $new_class; } $body->setAttribute("class", $new_class); echo $dom->saveHTML();

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.70.0090.00616.88
8.3.60.0110.00718.56
8.3.50.0100.00716.52
8.3.40.0040.01118.81
8.3.30.0140.00018.96
8.3.20.0050.00319.29
8.3.10.0030.00623.76
8.3.00.0070.00021.98
8.2.180.0150.00625.92
8.2.170.0100.01019.21
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0000.00824.66
8.2.130.0080.00022.38
8.2.120.0040.00426.35
8.2.110.0090.00019.58
8.2.100.0060.00617.96
8.2.90.0040.00418.00
8.2.80.0040.00417.97
8.2.70.0040.00418.05
8.2.60.0060.00318.28
8.2.50.0000.00818.10
8.2.40.0050.00319.78
8.2.30.0040.00419.59
8.2.20.0040.00418.21
8.2.10.0030.00618.55
8.2.00.0030.00619.63
8.1.280.0120.00325.92
8.1.270.0040.01122.25
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0090.00019.55
8.1.230.0030.00718.07
8.1.220.0040.00417.91
8.1.210.0050.00318.77
8.1.200.0060.00317.61
8.1.190.0060.00317.48
8.1.180.0030.00618.10
8.1.170.0080.00018.74
8.1.160.0040.00419.09
8.1.150.0070.00019.17
8.1.140.0000.00722.29
8.1.130.0050.00320.34
8.1.120.0000.00717.63
8.1.110.0000.00717.64
8.1.100.0050.00317.71
8.1.90.0070.00017.68
8.1.80.0040.00417.67
8.1.70.0040.00417.70
8.1.60.0040.00417.76
8.1.50.0000.00717.73
8.1.40.0030.00617.66
8.1.30.0000.00917.90
8.1.20.0030.00517.88
8.1.10.0000.00817.79
8.1.00.0070.00017.75
8.0.300.0050.00318.77
8.0.290.0030.00616.88
8.0.280.0000.00818.82
8.0.270.0040.00417.51
8.0.260.0030.00318.58
8.0.250.0040.00417.21
8.0.240.0040.00417.19
8.0.230.0040.00417.14
8.0.220.0000.00817.08
8.0.210.0070.00017.17
8.0.200.0000.00717.18
8.0.190.0040.00417.24
8.0.180.0000.00817.20
8.0.170.0000.00817.13
8.0.160.0040.00417.16
8.0.150.0100.00017.20
8.0.140.0040.00417.01
8.0.130.0030.00313.59
8.0.120.0000.00717.16
8.0.110.0020.00517.20
8.0.100.0000.00817.15
8.0.90.0040.00316.91
8.0.80.0100.01217.11
8.0.70.0040.00417.02
8.0.60.0000.00717.18
8.0.50.0020.00517.12
8.0.30.0110.00617.29
8.0.20.0130.01317.40
8.0.10.0040.00417.05
8.0.00.0120.01116.92
7.4.330.0060.00017.03
7.4.320.0030.00316.71
7.4.300.0030.00316.74
7.4.290.0000.00716.66
7.4.280.0000.00816.65
7.4.270.0030.00316.71
7.4.260.0050.00316.76
7.4.250.0000.00716.71
7.4.240.0030.00316.76
7.4.230.0040.00416.51
7.4.220.0050.00216.89
7.4.210.0090.00516.82
7.4.200.0030.00316.64
7.4.160.0130.00516.75
7.4.140.0120.00917.86
7.4.130.0140.00416.78
7.4.120.0100.01116.71
7.4.110.0150.00916.73
7.4.100.0120.01216.73
7.4.90.0160.00816.78
7.4.80.0110.00719.39
7.4.70.0060.01216.60
7.4.60.0030.01516.55
7.4.50.0030.01116.75
7.4.40.0060.01016.64
7.4.00.0030.01015.05
7.3.330.0000.00513.42
7.3.320.0050.00013.38
7.3.310.0040.00416.54
7.3.300.0070.00016.38
7.3.290.0000.00616.62
7.3.280.0090.01116.54
7.3.260.0080.00816.69
7.3.240.0060.01216.63
7.3.230.0100.01316.68
7.3.210.0110.00716.80
7.3.200.0120.00816.85
7.3.190.0060.01116.71
7.3.180.0050.01116.62
7.3.170.0130.00916.61
7.3.160.0060.00916.61
7.2.330.0090.00916.83
7.2.320.0160.00616.86
7.2.310.0120.00416.55
7.2.300.0120.00416.57
7.2.290.0130.00316.51
7.2.120.0440.00714.80
7.2.110.0410.00914.82
7.2.100.0410.01614.85
7.2.90.0420.01314.82
7.2.80.0450.01314.89
7.2.70.0470.00915.15
7.2.60.0400.00915.09
7.2.50.0760.00314.99
7.2.40.0510.00315.05
7.2.30.0450.00715.11
7.2.20.0500.00015.10
7.2.10.0470.00715.25
7.2.00.0440.01115.11
7.1.240.0460.01013.97
7.1.230.0360.01113.79
7.1.220.0500.00313.74
7.1.210.0410.01213.66
7.1.200.0460.01413.80
7.1.190.0460.00713.50
7.1.180.0420.00713.95
7.1.170.0550.01014.05
7.1.160.0370.01113.92
7.1.150.0580.00313.74
7.1.140.0490.01013.67
7.1.130.0470.01213.92
7.1.120.0530.00713.66
7.1.110.0490.01313.85
7.1.100.0500.01313.84
7.1.90.0550.00713.95
7.1.80.0550.00314.09
7.1.70.0460.00313.99
7.1.60.0410.01013.68
7.1.50.0530.00713.95
7.1.40.0490.01013.94
7.1.30.0520.00613.41
7.1.20.0540.00313.78
7.1.10.0490.00713.86
7.1.00.0570.00313.64
5.6.380.0100.01314.70

preferences:
65.7 ms | 401 KiB | 5 Q