3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<table id="transactions" class="table"> <thead> <tr> <th class="image"></th> <th class="title"><span>Title</span></th> <th class="date"><span>Date</span></th> </tr> </thead> <tbody> <tr class="tbody-tr"> <td class="image"> <img src="http://www.example.com/image.jpg"> </td> <td class="title">Title </td> <td class="date">12/16/2017 </td> </tr> <tr class="tbody-tr"> <td class="image"> <img src="http://www.example.com/image.jpg"> </td> <td class="title">Title </td> <td class="date">12/16/2017 </td> </tr> </tbody> </table>'; $doc = new DOMDocument(); $doc->loadHTML($html); $doc->formatOutput = true; foreach ($doc->getElementsByTagName('tr') as $tr) { // insert into thead > th if ($tr->childNodes->item(0)->nodeName == 'th') { $th = $doc->createElement('th'); $th->setAttribute('class', 'example'); $th->nodeValue = 'Example'; $tr->insertBefore($th, $tr->childNodes->item(3)); } // insert into body > td else { $td = $doc->createElement('td'); $td->setAttribute('class', 'example'); $tr->insertBefore($td, $tr->childNodes->item(3)); } } echo $doc->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.130.0040.00418.53
8.3.120.0000.00919.24
8.3.110.0030.00720.94
8.3.100.0060.00318.55
8.3.90.0030.00616.75
8.3.80.0000.00918.81
8.3.70.0060.01016.75
8.3.60.0060.00917.00
8.3.50.0110.00517.71
8.3.40.0110.00419.27
8.3.30.0060.00919.04
8.3.20.0080.00022.19
8.3.10.0090.00023.73
8.3.00.0020.00422.02
8.2.250.0100.01317.06
8.2.240.0040.00419.27
8.2.230.0060.00322.58
8.2.220.0060.00324.06
8.2.210.0000.01026.77
8.2.200.0030.00916.88
8.2.190.0070.01316.88
8.2.180.0140.00718.79
8.2.170.0170.00322.96
8.2.160.0060.01322.96
8.2.150.0040.00424.18
8.2.140.0000.00724.66
8.2.130.0040.00422.59
8.2.120.0040.00426.35
8.2.110.0060.00321.24
8.2.100.0120.00017.84
8.2.90.0050.00319.18
8.2.80.0080.00017.97
8.2.70.0050.00317.88
8.2.60.0030.00618.30
8.2.50.0050.00318.59
8.2.40.0000.00920.98
8.2.30.0000.00719.43
8.2.20.0050.00218.22
8.2.10.0040.00418.34
8.2.00.0030.00518.29
8.1.300.0000.01720.00
8.1.290.0060.00318.88
8.1.280.0120.00625.92
8.1.270.0050.00323.95
8.1.260.0050.00226.35
8.1.250.0070.00328.09
8.1.240.0030.00722.94
8.1.230.0060.00618.20
8.1.220.0030.00518.04
8.1.210.0000.00818.77
8.1.200.0030.00617.85
8.1.190.0040.00417.50
8.1.180.0000.00818.10
8.1.170.0050.00318.96
8.1.160.0070.00019.01
8.1.150.0050.00219.27
8.1.140.0030.00519.28
8.1.130.0000.00721.07
8.1.120.0050.00517.74
8.1.110.0080.00017.71
8.1.100.0030.00717.67
8.1.90.0040.00417.78
8.1.80.0080.00017.73
8.1.70.0030.00517.70
8.1.60.0080.00017.83
8.1.50.0040.00417.88
8.1.40.0000.00817.79
8.1.30.0030.00617.94
8.1.20.0040.00417.93
8.1.10.0030.00517.77
8.1.00.0000.00717.88
8.0.300.0070.00018.77
8.0.290.0000.00816.88
8.0.280.0000.00718.66
8.0.270.0030.00317.47
8.0.260.0050.00217.07
8.0.250.0030.00317.27
8.0.240.0030.00317.23
8.0.230.0060.00317.14
8.0.220.0040.00417.11
8.0.210.0070.00017.11
8.0.200.0000.00717.18
8.0.190.0060.00317.20
8.0.180.0040.00417.22
8.0.170.0000.00817.18
8.0.160.0000.00917.13
8.0.150.0070.00017.15
8.0.140.0060.00317.15
8.0.130.0000.00613.61
8.0.120.0050.00317.09
8.0.110.0000.00817.19
8.0.100.0040.00417.16
8.0.90.0000.00717.08
8.0.80.0140.00717.21
8.0.70.0040.00417.08
8.0.60.0040.00417.17
8.0.50.0000.00817.23
8.0.30.0110.00717.37
8.0.20.0110.00917.47
8.0.10.0040.00417.30
8.0.00.0070.01116.97
7.4.330.0050.00017.07
7.4.320.0000.00616.82
7.4.300.0030.00316.86
7.4.290.0000.00816.89
7.4.280.0030.00616.89
7.4.270.0110.00016.90
7.4.260.0040.00416.84
7.4.250.0060.00316.93
7.4.240.0070.00016.89
7.4.230.0050.00316.57
7.4.220.0040.00416.93
7.4.210.0060.01316.74
7.4.200.0040.00317.04
7.4.160.0090.00616.85
7.4.150.0120.00617.40
7.4.140.0090.00917.86
7.4.130.0120.00716.83
7.4.120.0110.00816.80
7.4.110.0070.01016.61
7.4.100.0120.00616.73
7.4.90.0090.00916.65
7.4.80.0130.00517.69
7.4.70.0080.01016.67
7.4.60.0090.01016.68
7.4.50.0100.00816.80
7.4.40.0120.00716.65
7.4.30.0080.01016.70
7.4.20.0090.01016.79
7.4.10.0090.01216.70
7.4.00.0100.01016.50
7.3.330.0000.00513.30
7.3.320.0030.00313.34
7.3.310.0070.00016.37
7.3.300.0000.00716.54
7.3.290.0070.00016.50
7.3.280.0120.00416.50
7.3.270.0130.00717.40
7.3.260.0100.00716.62
7.3.250.0070.01016.68
7.3.240.0090.01116.55
7.3.230.0060.01316.62
7.3.220.0140.00316.46
7.3.210.0090.00916.58
7.3.200.0090.00916.59
7.3.190.0140.00516.55
7.3.180.0110.00816.63
7.3.170.0100.00716.44
7.3.160.0090.00916.54
7.3.150.0120.00816.58
7.3.140.0100.00916.57
7.3.130.0090.01016.52
7.3.120.0090.00916.64
7.3.110.0100.00816.48
7.3.100.0070.00916.34
7.3.90.0110.00716.28
7.3.80.0110.00916.32
7.3.70.0050.01516.22
7.3.60.0090.00916.23
7.3.50.0080.01116.14
7.3.40.0090.01016.28
7.3.30.0070.01016.26
7.3.20.0100.00916.27
7.3.10.0080.01016.20
7.3.00.0100.00816.32
7.2.340.0160.01016.91
7.2.330.0050.01516.94
7.2.320.0120.00816.93
7.2.310.0120.00816.79
7.2.300.0110.00816.79
7.2.290.0100.01116.78
7.2.280.0090.01216.79
7.2.270.0110.01016.90
7.2.260.0110.01116.84
7.2.250.0100.01016.69
7.2.240.0080.01416.69
7.2.230.0090.01116.46
7.2.220.0090.00916.64
7.2.210.0110.00816.50
7.2.200.0130.00716.51
7.2.190.0120.00816.50
7.2.180.0070.01216.54
7.2.170.0110.00816.52
7.2.160.0120.00716.58
7.2.150.0090.01116.64
7.2.140.0100.01116.60
7.2.130.0120.00816.58
7.2.120.0120.00816.61
7.2.110.0120.00816.64
7.2.100.0170.00816.62
7.2.90.0100.01116.60
7.2.80.0140.00916.54
7.2.70.0140.00816.62
7.2.60.0120.00816.65
7.2.50.0110.00916.53
7.2.40.0150.00716.57
7.2.30.0120.01116.62
7.2.20.0180.01016.57
7.2.10.0140.00716.58
7.2.00.0150.01017.06
7.1.330.0200.00915.89
7.1.320.0190.00815.64
7.1.310.0160.00715.54
7.1.300.0140.01015.50
7.1.290.0130.01015.45
7.1.280.0130.00815.52
7.1.270.0140.00715.45
7.1.260.0140.00915.43
7.1.250.0140.00715.49
7.1.240.0170.00615.39
7.1.230.0260.00615.41
7.1.220.0170.00615.44
7.1.210.0280.00815.41
7.1.200.0170.00615.51
7.1.190.0170.00715.40
7.1.180.0120.01015.41
7.1.170.0130.01115.44
7.1.160.0170.00715.39
7.1.150.0100.01115.37
7.1.140.0160.00815.45
7.1.130.0170.00915.46
7.1.120.0130.01115.81
7.1.110.0150.00915.66
7.1.100.0170.01015.66
7.1.90.0210.01015.63
7.1.80.0200.00615.69
7.1.70.0160.01015.46
7.1.60.0260.00719.87
7.1.50.0190.01019.82
7.1.40.0240.00919.84
7.1.30.0230.01119.77
7.1.20.0210.01119.79
7.1.10.0170.00815.28
7.1.00.0170.00915.29
7.0.330.0150.01015.02
7.0.320.0110.00915.03
7.0.310.0170.00815.11
7.0.300.0130.01115.20
7.0.290.0190.00915.04
7.0.280.0140.00715.04
7.0.270.0140.01015.08
7.0.260.0120.01015.48
7.0.250.0120.01015.36
7.0.240.0230.00915.37
7.0.230.0140.01115.45
7.0.220.0130.01115.40
7.0.210.0160.00715.17
7.0.200.0130.00915.14
7.0.190.0170.00815.12
7.0.180.0150.01015.04
7.0.170.0160.00814.96
7.0.160.0160.00914.98
7.0.150.0140.00814.98
7.0.140.0170.00914.97
7.0.130.0190.01215.06
7.0.120.0200.00915.08
7.0.110.0140.01114.98
7.0.100.0110.01115.02
7.0.90.0180.00915.02
7.0.80.0140.01114.96
7.0.70.0160.00914.94
7.0.60.0130.00914.90
7.0.50.0140.00815.05
7.0.40.0120.01014.97
7.0.30.0140.00714.94
7.0.20.0150.00814.94
7.0.10.0220.01014.90
7.0.00.0180.00914.88
5.6.400.0110.01215.78
5.6.390.0120.01115.81
5.6.380.0160.01115.95
5.6.370.0160.00915.65
5.6.360.0150.01115.92
5.6.350.0150.00815.95
5.6.340.0140.01015.85
5.6.330.0150.00815.90
5.6.320.0120.01115.96
5.6.310.0120.01115.95
5.6.300.0140.02417.08
5.6.290.0090.02417.10
5.6.280.0130.02217.18
5.6.270.0160.02217.16
5.6.260.0140.02317.14
5.6.250.0140.02117.00
5.6.240.0130.02217.07
5.6.230.0160.02717.18
5.6.220.0140.02717.07
5.6.210.0100.02517.16
5.6.200.0100.02417.00
5.6.190.0120.02417.08
5.6.180.0120.02117.02
5.6.170.0110.02316.99
5.6.160.0110.02317.02
5.6.150.0090.02217.04
5.6.140.0090.02516.98
5.6.130.0100.02517.06
5.6.120.0100.02416.98
5.6.110.0130.02017.07
5.6.100.0140.02017.01
5.6.90.0190.01717.03
5.6.80.0140.02116.78
5.6.70.0120.02216.80
5.6.60.0100.02516.84
5.6.50.0130.01916.85
5.6.40.0130.02216.97
5.6.30.0170.02316.86
5.6.20.0170.02116.92
5.6.10.0120.02416.86
5.6.00.0170.02016.95

preferences:
51.96 ms | 406 KiB | 6 Q