3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Load up the HTML in DOMDocument $doc = new DOMDocument; $doc->loadHTML( '<a class="modal">Stuff</a>'); // Or: $doc->loadHTML( $this->form->getInput('image_intro', 'images')); // Create a new XPath object to find the correct <a> tags $xpath = new DOMXPath( $doc); // Iterate over all <a class="modal"> tags foreach( $xpath->query( "//a[@class='modal']") as $a) { // Set the class attribute correctly $a->setAttribute( 'class', $a->getAttribute( 'class') . '-link'); echo $doc->saveHTML( $a); // Print the fixed <a> tag }

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.01316.88
8.3.50.0140.00717.76
8.3.40.0110.00419.09
8.3.30.0060.00918.96
8.3.20.0070.00718.71
8.3.10.0080.00018.94
8.3.00.0060.00319.35
8.2.180.0070.01116.98
8.2.170.0160.00022.96
8.2.160.0070.01319.21
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0030.00918.05
8.2.110.0030.00622.40
8.2.100.0080.00419.63
8.2.90.0040.00418.00
8.2.80.0060.00319.03
8.2.70.0060.00317.75
8.2.60.0090.00018.28
8.2.50.0000.00818.30
8.2.40.0030.00519.73
8.2.30.0060.00317.93
8.2.20.0040.00918.11
8.2.10.0040.00418.13
8.2.00.0040.00418.04
8.1.280.0060.00925.92
8.1.270.0080.00023.99
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0030.00624.16
8.1.230.0040.00819.45
8.1.220.0090.00018.01
8.1.210.0080.00018.77
8.1.200.0080.00017.60
8.1.190.0000.00917.60
8.1.180.0000.00818.10
8.1.170.0000.00817.72
8.1.160.0060.00319.39
8.1.150.0040.00419.00
8.1.140.0050.00317.73
8.1.130.0080.00017.82
8.1.120.0040.00417.83
8.1.110.0040.00417.71
8.1.100.0050.00217.64
8.1.90.0040.00317.73
8.1.80.0020.00517.73
8.1.70.0000.00717.70
8.1.60.0080.00017.82
8.1.50.0070.00017.72
8.1.40.0040.00417.92
8.1.30.0110.00017.92
8.1.20.0040.00418.02
8.1.10.0050.00217.92
8.1.00.0000.00817.90
8.0.300.0020.00518.77
8.0.290.0040.00417.00
8.0.280.0050.00318.96
8.0.270.0000.00717.71
8.0.260.0000.00717.08
8.0.250.0050.00517.18
8.0.240.0050.00317.27
8.0.230.0040.00417.33
8.0.220.0000.00817.28
8.0.210.0040.00417.13
8.0.200.0070.00017.31
8.0.190.0050.00217.18
8.0.180.0000.00817.21
8.0.170.0000.00917.28
8.0.160.0040.00417.27
8.0.150.0080.00017.18
8.0.140.0000.00917.13
8.0.130.0030.00313.64
8.0.120.0070.00417.07
8.0.110.0050.00317.23
8.0.100.0040.00417.23
8.0.90.0030.00317.01
8.0.80.0070.01017.15
8.0.70.0050.00317.16
8.0.60.0000.00717.23
8.0.50.0050.00216.96
8.0.30.0130.00317.37
8.0.20.0060.01517.49
8.0.10.0040.00417.19
8.0.00.0130.00717.23
7.4.330.0030.00313.41
7.4.320.0000.00616.73
7.4.300.0000.00616.87
7.4.290.0040.00416.82
7.4.280.0040.00416.88
7.4.270.0040.00416.97
7.4.260.0050.00313.66
7.4.250.0030.00716.80
7.4.240.0000.00716.79
7.4.230.0040.00416.94
7.4.220.0090.00617.03
7.4.210.0150.00416.89
7.4.200.0040.00416.95
7.4.190.0050.00317.01
7.4.160.0040.01216.80
7.4.150.0080.00816.64
7.4.140.0060.01217.86
7.4.130.0070.01316.90
7.4.120.0060.01216.96
7.4.110.0160.00716.63
7.4.100.0100.00716.76
7.4.90.0060.01216.91
7.4.80.0030.01419.39
7.4.70.0060.01016.79
7.4.60.0100.00716.79
7.4.50.0000.00516.70
7.4.40.0040.01116.69
7.4.30.0110.00516.82
7.4.00.0100.00715.04
7.3.330.0050.00013.28
7.3.320.0030.00313.34
7.3.310.0040.00216.59
7.3.300.0070.00016.37
7.3.290.0070.00816.56
7.3.280.0120.00316.56
7.3.270.0070.01016.75
7.3.260.0110.00616.50
7.3.240.0030.01416.55
7.3.230.0040.01316.54
7.3.210.0070.01716.46
7.3.200.0000.01616.54
7.3.190.0060.00916.78
7.3.180.0070.00716.62
7.3.170.0070.01416.68
7.3.160.0060.01016.69
7.3.120.0140.00314.93
7.3.10.0040.01116.68
7.3.00.0000.01316.83
7.2.330.0030.01416.88
7.2.320.0090.00917.21
7.2.310.0060.01216.71
7.2.300.0160.00017.06
7.2.290.0070.01017.05
7.2.130.0000.01516.95
7.2.120.0060.00617.34
7.2.110.0030.00617.01
7.2.100.0060.00617.17
7.2.90.0000.00916.97
7.2.80.0060.00317.13
7.2.70.0000.01117.15
7.2.60.0000.01817.16
7.2.50.0040.00717.16
7.2.40.0060.00616.94
7.2.30.0040.00816.91
7.2.20.0000.00917.01
7.2.10.0000.01017.09
7.2.00.0040.01118.26
7.1.250.0090.00315.49
7.1.100.0040.00718.08
7.1.70.0030.00517.09
7.1.60.0130.01319.21
7.1.50.0120.01217.05
7.1.00.0030.03722.57
7.0.200.0030.00616.90
7.0.140.0030.07322.15
7.0.120.0030.07022.29
7.0.60.0100.08020.15
7.0.50.0130.07717.95
7.0.40.0030.04720.45
7.0.30.0270.08320.25
7.0.20.0070.05020.14
7.0.10.0070.04720.14
7.0.00.0170.07320.37
5.6.280.0070.07021.22
5.6.210.0100.04020.65
5.6.200.0100.06318.27
5.6.190.0000.06720.81
5.6.180.0230.04320.57
5.6.170.0270.07720.62
5.6.160.0030.09020.71
5.6.150.0030.04718.29
5.6.140.0070.05018.36
5.6.130.0030.05018.36
5.6.120.0030.09021.19
5.6.110.0030.08321.11
5.6.100.0130.07721.15
5.6.90.0170.06721.23
5.6.80.0070.03720.36
5.5.350.0230.08020.59
5.5.340.0070.07018.13
5.5.330.0030.06020.67
5.5.320.0270.07720.51
5.5.310.0270.04020.55
5.5.300.0170.07018.18
5.5.290.0070.05018.08
5.5.280.0100.03720.77
5.5.270.0100.05720.97
5.5.260.0070.08721.07
5.5.250.0070.06720.90
5.5.240.0070.07320.15
5.4.450.0300.04719.63
5.4.440.0500.05319.55
5.4.430.0500.03319.62
5.4.420.0470.06319.46
5.4.410.0530.06719.41
5.4.400.0370.04019.31
5.4.390.0400.03719.40
5.4.380.0370.04719.00
5.4.370.0470.06719.40
5.4.360.0500.06319.27
5.4.350.0500.05719.11
5.4.340.0470.06019.28
5.4.320.0330.06019.05
5.4.310.0470.05719.28
5.4.300.0370.05719.36
5.4.290.0500.05319.26
5.4.280.0430.03319.08
5.4.270.0300.06019.23
5.4.260.0330.04019.28
5.4.250.0400.04719.39
5.4.240.0470.05019.05
5.4.230.0470.05719.30
5.4.220.0530.06319.23
5.4.210.0630.05319.02
5.4.200.0530.06019.27
5.4.190.0470.06719.02
5.4.180.0530.06019.05
5.4.170.0400.06319.07
5.4.160.0330.05019.37
5.4.150.0470.06719.00
5.4.140.0330.03716.57
5.4.130.0430.05716.48
5.4.120.0400.04316.42
5.4.110.0430.06316.64
5.4.100.0570.05016.46
5.4.90.0470.06716.32
5.4.80.0400.03016.68
5.4.70.0330.04316.65
5.4.60.0500.05716.63
5.4.50.0500.05316.55
5.4.40.0530.05716.68
5.4.30.0500.06316.58
5.4.20.0530.05716.57
5.4.10.0470.05016.64
5.4.00.0330.04015.99
5.3.290.0400.06714.80
5.3.280.0500.06314.80
5.3.270.0530.04314.80
5.3.260.0470.06314.84
5.3.250.0370.04014.80
5.3.240.0470.04314.80
5.3.230.0470.06714.80
5.3.220.0530.05314.80
5.3.210.0570.05714.82
5.3.200.0470.07014.82
5.3.190.0500.04714.80
5.3.180.0300.04714.80
5.3.170.0530.06314.80
5.3.160.0500.05314.80
5.3.150.0530.06014.80
5.3.140.0330.06014.80
5.3.130.0330.05314.80
5.3.120.0430.05014.80
5.3.110.0400.04714.80
5.3.100.0430.04714.80
5.3.90.0400.05014.80
5.3.80.0470.05014.80
5.3.70.0430.03714.80
5.3.60.0470.04714.80
5.3.50.0430.06714.80
5.3.40.0530.06014.80
5.3.30.0500.03014.80
5.3.20.0530.05714.80
5.3.10.0500.05014.80
5.3.00.0470.06314.80
5.2.170.0400.04714.80
5.2.160.0370.05014.80
5.2.150.0400.05314.80
5.2.140.0530.04714.80
5.2.130.0400.05314.80
5.2.120.0300.05014.80
5.2.110.0400.05714.80
5.2.100.0400.03314.80
5.2.90.0370.03014.80
5.2.80.0300.03314.80
5.2.70.0400.03014.80
5.2.60.0500.04714.80
5.2.50.0330.05014.80
5.2.40.0330.05314.80
5.2.30.0400.05014.80
5.2.20.0330.03714.80
5.2.10.0300.04314.80
5.2.00.0370.03314.80
5.1.60.0370.04714.80
5.1.50.0300.05714.80
5.1.40.0370.04714.80
5.1.30.0300.05314.80
5.1.20.0370.02314.80
5.1.10.0300.04314.80
5.1.00.0300.03314.80
5.0.50.0170.04314.80
5.0.40.0230.03714.80
5.0.30.0170.06314.80
5.0.20.0200.04314.80
5.0.10.0170.04014.80
5.0.00.0200.04014.80
4.4.90.0230.02714.80
4.4.80.0170.03314.80
4.4.70.0170.01314.80
4.4.60.0130.01314.80
4.4.50.0200.03014.80
4.4.40.0170.03714.80
4.4.30.0200.02714.80
4.4.20.0270.01314.80
4.4.10.0170.02014.80
4.4.00.0100.03314.80
4.3.110.0170.02014.80
4.3.100.0130.03714.80
4.3.90.0130.02314.80
4.3.80.0200.02714.80
4.3.70.0170.02014.80
4.3.60.0170.03314.80
4.3.50.0170.03314.80
4.3.40.0170.02714.80
4.3.30.0100.02714.80
4.3.20.0100.03314.80
4.3.10.0070.03014.80
4.3.00.0100.03314.80

preferences:
45.08 ms | 401 KiB | 5 Q