3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = <<<END <table class="behaviourtable table"> <tr> <th>Existing column1</th> <th>Existing column2</th> <th>Existing column3</th> </tr><tr> <td>A</td> <td>B</td> <td>C</td> </tr><tr> <td>D</td> <td>E</td> <td>F</td> </tr><tr> <td class="text-info">G</td> </tr> </table> END; $dom = new DOMDocument();//Loads DOM document $dom->loadHTML($str);//Loads HTML from a previously set variable $xpath = new DOMXPath($dom); $tables = $xpath->query('//table[@class="behaviourtable table"]');//Get only table from HTML $commsTable = ''; foreach ($tables as $table) { $commsTable .= $dom->saveXML($table); } $commsHTML = new DOMDocument(); $commsHTML->loadHTML($commsTable); $tr = $commsHTML->getElementsByTagName('tr'); $th = $commsHTML->createElement('th', 'Comment'); $tr->item(0)->appendChild($th); $xpathcomms = new DOMXPath($commsHTML); $comments = $xpathcomms->query('//td[@class="text-info"]'); if($comments->length > 0){ foreach($comments as $comment){ $parent = $comment->parentNode; $parent->previousSibling->appendChild($comment); } } echo $commsHTML->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.60.0080.00816.97
8.3.50.0060.01322.20
8.3.40.0130.00319.44
8.3.30.0090.00619.04
8.3.20.0040.00422.27
8.3.10.0040.00422.33
8.3.00.0040.00423.98
8.2.180.0160.00325.92
8.2.170.0080.00819.21
8.2.160.0110.00422.96
8.2.150.0040.00425.66
8.2.140.0030.00524.66
8.2.130.0040.00420.02
8.2.120.0030.00526.35
8.2.110.0070.00219.56
8.2.100.0060.00618.66
8.2.90.0030.00618.00
8.2.80.0000.00818.13
8.2.70.0000.00818.54
8.2.60.0000.00818.49
8.2.50.0060.00318.10
8.2.40.0000.00819.64
8.2.30.0050.00321.41
8.2.20.0030.00518.49
8.2.10.0000.00918.66
8.2.00.0000.01118.15
8.1.280.0150.00425.92
8.1.270.0040.00424.66
8.1.260.0060.00328.09
8.1.250.0040.00428.09
8.1.240.0030.00622.56
8.1.230.0070.00419.45
8.1.220.0050.00318.25
8.1.210.0000.00818.77
8.1.200.0000.01217.73
8.1.190.0040.00417.63
8.1.180.0000.00918.10
8.1.170.0030.00619.15
8.1.160.0030.00522.66
8.1.150.0040.00419.30
8.1.140.0040.00420.02
8.1.130.0030.00319.39
8.1.120.0050.00317.85
8.1.110.0030.00517.92
8.1.100.0040.00417.88
8.1.90.0030.00517.93
8.1.80.0050.00317.93
8.1.70.0030.00517.82
8.1.60.0040.00417.91
8.1.50.0040.00417.88
8.1.40.0060.00318.02
8.1.30.0060.00318.12
8.1.20.0050.00318.05
8.1.10.0000.00818.05
8.1.00.0080.00017.96
8.0.300.0040.00418.77
8.0.290.0000.00817.25
8.0.280.0000.00718.80
8.0.270.0040.00417.34
8.0.260.0030.00318.80
8.0.250.0070.00017.37
8.0.240.0030.00317.47
8.0.230.0030.00417.47
8.0.220.0040.00417.27
8.0.210.0000.00817.44
8.0.200.0070.00317.37
8.0.190.0080.00017.48
8.0.180.0030.00617.36
8.0.170.0030.00617.45
8.0.160.0040.00417.39
8.0.150.0070.00017.30
8.0.140.0000.00817.29
8.0.130.0030.00313.75
8.0.120.0000.00917.36
8.0.110.0040.00417.17
8.0.100.0000.00817.53
8.0.90.0050.00317.47
8.0.80.0130.00317.31
8.0.70.0030.00517.25
8.0.60.0000.00717.53
8.0.50.0050.00317.11
8.0.30.0100.00717.59
8.0.20.0080.01317.47
8.0.10.0040.01117.53
8.0.00.0100.00717.45
7.4.330.0030.00315.57
7.4.320.0030.00317.07
7.4.300.0030.00316.82
7.4.290.0040.00417.11
7.4.280.0000.00816.93
7.4.270.0030.00317.05
7.4.260.0050.00317.01
7.4.250.0040.00416.87
7.4.240.0040.00317.06
7.4.230.0040.00417.17
7.4.220.0060.01217.16
7.4.210.0070.01116.95
7.4.200.0030.00316.83
7.4.160.0070.01116.99
7.4.150.0100.01217.15
7.4.140.0060.01017.54
7.4.130.0100.00816.99
7.4.120.0090.00816.94
7.4.110.0110.00716.94
7.4.100.0130.00316.97
7.4.90.0040.01316.90
7.4.80.0110.00817.62
7.4.70.0060.01116.95
7.4.60.0100.01016.93
7.4.50.0080.01216.86
7.4.40.0070.01116.81
7.4.30.0110.00716.81
7.4.20.0070.01216.99
7.4.10.0100.00816.60
7.4.00.0060.01216.21
7.3.330.0030.00313.59
7.3.320.0000.00513.61
7.3.310.0030.00516.71
7.3.300.0070.00016.88
7.3.290.0120.00416.76
7.3.280.0070.01116.74
7.3.270.0030.01217.09
7.3.260.0080.00916.93
7.3.250.0090.00916.84
7.3.240.0110.00516.85
7.3.230.0120.00316.79
7.3.220.0100.00316.68
7.3.210.0070.00916.72
7.3.200.0120.00616.79
7.3.190.0120.00716.71
7.3.180.0100.01016.85
7.3.170.0100.00916.80
7.3.160.0120.00916.86
7.3.150.0120.00816.89
7.3.140.0100.00816.80
7.3.130.0090.01016.54
7.3.120.0080.01016.27
7.3.110.0090.00916.26
7.3.100.0100.00815.85
7.3.90.0070.01015.88
7.3.80.0110.00615.92
7.3.70.0100.00815.87
7.3.60.0080.01015.88
7.3.50.0060.01115.84
7.3.40.0060.01115.81
7.3.30.0090.00815.83
7.3.20.0110.00916.40
7.3.10.0090.00916.45
7.3.00.0100.00916.38
7.2.340.0290.00216.74
7.2.330.0110.01016.95
7.2.320.0100.01017.00
7.2.310.0130.01016.89
7.2.300.0110.01117.03
7.2.290.0120.01217.01
7.2.280.0130.00917.09
7.2.270.0110.01116.86
7.2.260.0120.01016.70
7.2.250.0090.01216.35
7.2.240.0080.01316.48
7.2.230.0090.01016.24
7.2.220.0080.01116.04
7.2.210.0090.01016.12
7.2.200.0100.00916.04
7.2.190.0100.00816.05
7.2.180.0080.01116.02
7.2.170.0080.01016.12
7.2.160.0100.00916.12
7.2.150.0100.01216.69
7.2.140.0120.00916.58
7.2.130.0090.01216.64
7.2.120.0090.00916.72
7.2.110.0180.00916.64
7.2.100.0110.00916.67
7.2.90.0140.00816.62
7.2.80.0100.01016.74
7.2.70.0140.00716.66
7.2.60.0130.01116.64
7.2.50.0130.00816.71
7.2.40.0110.00816.68
7.2.30.0100.00916.61
7.2.20.0110.00816.64
7.2.10.0110.00816.56
7.2.00.0130.01016.61
7.1.330.0140.01015.69
7.1.320.0120.00815.54
7.1.310.0130.01015.55
7.1.300.0100.01115.50
7.1.290.0130.00715.51
7.1.280.0120.01015.53
7.1.270.0120.00715.47
7.1.260.0110.01115.51
7.1.250.0120.01015.40
7.1.240.0150.00715.41
7.1.230.0180.00615.34
7.1.220.0160.00715.48
7.1.210.0140.00715.45
7.1.200.0140.00915.52
7.1.190.0140.00915.50
7.1.180.0150.00815.50
7.1.170.0130.00815.44
7.1.160.0300.00815.46
7.1.150.0130.01015.49
7.1.140.0140.00815.45
7.1.130.0130.00715.40
7.1.120.0150.00715.38
7.1.110.0150.00615.50
7.1.100.0130.01015.52
7.1.90.0150.01015.46
7.1.80.0160.00615.50
7.1.70.0170.00915.61
7.1.60.0170.00915.71
7.1.50.0160.00715.58
7.1.40.0120.00815.61
7.1.30.0140.00915.56
7.1.20.0160.00815.58
7.1.10.0130.00815.58
7.1.00.0130.00915.51
7.0.330.0160.00815.07
7.0.320.0110.00915.18
7.0.310.0170.00815.19
7.0.300.0140.00915.19
7.0.290.0120.00915.11
7.0.280.0170.00815.12
7.0.270.0120.01015.06
7.0.260.0140.00715.10
7.0.250.0120.00815.21
7.0.240.0160.00915.21
7.0.230.0120.00915.15
7.0.220.0140.00615.26
7.0.210.0110.01115.10
7.0.200.0120.00815.29
7.0.190.0150.00515.30
7.0.180.0110.00915.25
7.0.170.0120.00815.25
7.0.160.0150.00815.20
7.0.150.0150.00815.21
7.0.140.0090.01115.31
7.0.130.0140.01115.38
7.0.120.0120.00715.32
7.0.110.0140.01015.25
7.0.100.0130.01015.31
7.0.90.0160.00915.26
7.0.80.0120.00915.32
7.0.70.0160.00615.24
7.0.60.0160.00715.22
7.0.50.0120.01015.27
7.0.40.0150.00815.04
7.0.30.0120.00915.04
7.0.20.0120.00815.02
7.0.10.0120.01015.05
7.0.00.0110.00915.05
5.6.400.0110.01215.59
5.6.390.0130.01015.39
5.6.380.0120.00915.49
5.6.370.0120.01115.53
5.6.360.0110.01115.63
5.6.350.0110.01115.44
5.6.340.0120.01015.53
5.6.330.0150.00815.54
5.6.320.0140.00915.42
5.6.310.0110.01115.53
5.6.300.0120.01816.28
5.6.290.0130.01216.15
5.6.280.0160.01216.20
5.6.270.0120.01316.18
5.6.260.0130.01716.24
5.6.250.0070.01816.19
5.6.240.0110.01616.21
5.6.230.0130.01316.25
5.6.220.0150.01216.28
5.6.210.0150.01316.15
5.6.200.0120.01516.16
5.6.190.0110.01616.18
5.6.180.0100.01616.13
5.6.170.0120.01416.16
5.6.160.0120.01416.16
5.6.150.0120.01416.33
5.6.140.0130.01316.14
5.6.130.0140.01116.30
5.6.120.0130.01216.15
5.6.110.0130.01316.19
5.6.100.0110.01616.14
5.6.90.0130.01316.17
5.6.80.0140.01116.03
5.6.70.0130.01216.11
5.6.60.0110.01515.98
5.6.50.0140.01616.07
5.6.40.0100.01416.09
5.6.30.0090.01816.11
5.6.20.0110.01316.07
5.6.10.0110.01316.07
5.6.00.0120.01216.11
5.5.380.0180.01416.37
5.5.370.0160.01416.32
5.5.360.0210.01016.20
5.5.350.0210.00716.41
5.5.340.0160.01016.39
5.5.330.0190.00916.27
5.5.320.0140.01416.31
5.5.310.0210.00916.26
5.5.300.0170.01116.31
5.5.290.0170.01116.38
5.5.280.0160.01416.24
5.5.270.0170.01016.22
5.5.260.0160.01216.33
5.5.250.0200.00916.23
5.5.240.0140.01616.23
5.5.230.0130.01316.28
5.5.220.0150.01116.26
5.5.210.0180.00916.24
5.5.200.0160.01016.17
5.5.190.0110.01416.19
5.5.180.0180.00816.21
5.5.170.0140.01116.24
5.5.160.0190.00916.29
5.5.150.0190.00816.21
5.5.140.0200.01316.22
5.5.130.0170.01016.05
5.5.120.0120.01516.06
5.5.110.0130.01316.11
5.5.100.0170.01216.20
5.5.90.0150.01216.15
5.5.80.0190.01016.20
5.5.70.0200.01116.21
5.5.60.0160.01416.21
5.5.50.0200.01016.17
5.5.40.0180.01116.16
5.5.30.0140.01416.26
5.5.20.0160.01216.14
5.5.10.0170.01116.21
5.5.00.0140.01116.12
5.4.450.0140.00713.02
5.4.440.0150.00713.01
5.4.430.0160.00713.07
5.4.420.0130.00813.06
5.4.410.0150.00513.08
5.4.400.0160.00712.95
5.4.390.0130.00712.94
5.4.380.0150.00612.90
5.4.370.0140.00713.10
5.4.360.0130.00612.93
5.4.350.0150.00612.99
5.4.340.0140.00712.97
5.4.330.0120.00913.04
5.4.320.0100.01113.01
5.4.310.0150.00712.91
5.4.300.0140.00812.87
5.4.290.0170.00513.09
5.4.280.0120.00912.90
5.4.270.0150.00712.95
5.4.260.0150.01112.88
5.4.250.0150.00712.92
5.4.240.0120.01012.84
5.4.230.0150.00912.88
5.4.220.0130.00912.87
5.4.210.0150.00812.91
5.4.200.0160.00712.97
5.4.190.0110.01112.91
5.4.180.0160.00712.85
5.4.170.0150.00612.84
5.4.160.0100.01212.87
5.4.150.0130.00812.85
5.4.140.0150.00612.89
5.4.130.0150.00912.93
5.4.120.0110.01012.92
5.4.110.0130.00712.95
5.4.100.0140.00713.01
5.4.90.0150.00512.98
5.4.80.0140.00612.97
5.4.70.0110.01013.05
5.4.60.0140.00613.00
5.4.50.0100.01112.98
5.4.40.0080.01213.01
5.4.30.0120.00813.05
5.4.20.0140.00713.01
5.4.10.0120.00813.00
5.4.00.0100.00912.88
5.3.290.0160.00813.57
5.3.280.0130.01113.42
5.3.270.0120.01113.54
5.3.260.0140.00913.50
5.3.250.0120.01013.43
5.3.240.0110.01113.29
5.3.230.0150.01013.42
5.3.220.0120.01213.29
5.3.210.0150.00813.29
5.3.200.0120.00913.33
5.3.190.0150.00613.37
5.3.180.0160.00713.46
5.3.170.0130.00713.52
5.3.160.0140.00913.56
5.3.150.0150.00613.46
5.3.140.0130.00913.48
5.3.130.0130.00913.31
5.3.120.0140.00813.49
5.3.110.0160.00813.38
5.3.100.0100.01113.37
5.3.90.0120.00913.39
5.3.80.0120.00913.23
5.3.70.0120.00813.27
5.3.60.0140.00613.38
5.3.50.0120.00913.35
5.3.40.0110.01013.26
5.3.30.0130.00813.34
5.3.20.0100.01013.39
5.3.10.0120.00913.07
5.3.00.0130.00913.22
5.2.170.0110.00812.46
5.2.160.0090.00912.47
5.2.150.0100.00712.49
5.2.140.0090.00812.35
5.2.130.0130.00612.45
5.2.120.0120.00612.42
5.2.110.0070.01212.41
5.2.100.0110.00712.40
5.2.90.0130.00512.30
5.2.80.0090.01012.24
5.2.70.0130.00512.30
5.2.60.0140.00512.25
5.2.50.0100.00712.25
5.2.40.0090.00812.28
5.2.30.0100.00812.24
5.2.20.0090.00912.25
5.2.10.0100.00812.21
5.2.00.0090.00812.12
5.1.60.0100.00711.79
5.1.50.0100.00811.76
5.1.40.0080.00811.88
5.1.30.0090.00811.90
5.1.20.0090.00911.85
5.1.10.0110.00611.78
5.1.00.0090.00811.77
5.0.50.0100.00411.72
5.0.40.0110.00411.72
5.0.30.0070.00711.72
5.0.20.0100.00511.72
5.0.10.0100.00511.72
5.0.00.0080.00611.72
4.4.90.0060.00311.72
4.4.80.0060.00311.72
4.4.70.0060.00211.72
4.4.60.0050.00311.72
4.4.50.0050.00311.72
4.4.40.0050.00311.72
4.4.30.0040.00411.72
4.4.20.0040.00511.72
4.4.10.0050.00411.72
4.4.00.0060.00211.72
4.3.110.0050.00311.72
4.3.100.0040.00411.72
4.3.90.0070.00211.72
4.3.80.0030.00711.72
4.3.70.0030.00511.72
4.3.60.0060.00211.72
4.3.50.0060.00311.72
4.3.40.0050.00211.72
4.3.30.0050.00211.72
4.3.20.0040.00311.72
4.3.10.0030.00411.72
4.3.00.0020.00511.72

preferences:
66.65 ms | 401 KiB | 5 Q