3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <!DOCTYPE html> <html> <head> <title></title> </head> <body> <table class="table-list table table-responsive table-striped" border="1"> <thead> <tr> <th class="coll-1 name">name</th> <th class="coll-2">height</th> <th class="coll-3">weight</th> <th class="coll-date">date</th> <th class="coll-4"><span class="info">info</span></th> <th class="coll-5">country</th> </tr> </thead> <tbody> <tr> <td class="coll-1 name"> <a href="/username/Jhon Doe/" class="icon"><i class="flaticon-user"></i></a> <a href="/username/Jhon Doe/">Jhon Doe</a> </td> <td class="coll-2 height">45</td> <td class="coll-3 weight">50</td> <td class="coll-date">9am May. 16th</td> <td class="coll-4 size mob-info">abcd</td> <td class="coll-5 country"><a href="/country/CA/">CA</a></td> </tr> <tr> <td class="coll-1 name"> <a href="/username/Kasim Shk/" class="icon"><i class="flaticon-user"></i></a> <a href="/username/Kasim Shk/">Kasim Shk</a> </td> <td class="coll-2 height">33</td> <td class="coll-3 weight">54</td> <td class="coll-date">Mar. 14th '18</td> <td class="coll-4 size mob-info">ijkl</td> <td class="coll-5 country"><a href="/country/UAE/">UAE</a></td> </tr> </tbody> </table> </body> </html> HTML; $dom = new DOMDocument; $dom->loadHTML($html); $xpath = new DOMXPath($dom); foreach ($xpath->query('//tbody/tr') as $tr) { $tmp = []; // reset the temporary array so previous entries are removed foreach ($xpath->query("td[@class]", $tr) as $td) { $key = preg_match('~[a-z]+$~', $td->getAttribute('class'), $out) ? $out[0] : 'no_class'; if ($key === "name") { $tmp['user_link'] = $xpath->query("a[@class = 'icon']", $td)[0]->getAttribute('href'); } $tmp[$key] = trim($td->textContent); } $tmp['date'] = date("M. dS 'y", strtotime(preg_replace('~\.|\d+[ap]m *~', '', $tmp['date']))); $result[] = $tmp; } var_export($result); echo "\n----\n"; echo json_encode($result);

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.4.20.0060.01320.32
8.4.10.0030.01419.41
8.3.150.0070.01419.27
8.3.140.0070.01117.38
8.3.130.0000.01019.17
8.3.120.0100.01019.69
8.3.110.0000.01020.94
8.3.100.0000.01124.06
8.3.90.0090.00626.77
8.3.80.0090.00017.97
8.3.70.0130.00317.25
8.3.60.0090.00618.95
8.3.50.0070.00818.31
8.3.40.0130.00619.59
8.3.30.0030.01219.59
8.3.20.0040.00419.83
8.3.10.0030.00522.36
8.3.00.0040.00420.17
8.2.270.0030.01617.47
8.2.260.0030.00619.10
8.2.250.0030.00717.31
8.2.240.0070.01019.38
8.2.230.0000.00822.58
8.2.220.0060.00337.54
8.2.210.0080.00026.77
8.2.200.0070.00317.50
8.2.190.0120.00317.25
8.2.180.0120.00617.25
8.2.170.0110.01122.96
8.2.160.0070.00719.83
8.2.150.0090.00024.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0000.00821.44
8.2.110.0060.00321.38
8.2.100.0180.00618.52
8.2.90.0160.00418.64
8.2.80.0140.00519.03
8.2.70.0090.00618.45
8.2.60.0160.00418.50
8.2.50.0150.00518.41
8.2.40.0110.00519.31
8.2.30.0120.00618.84
8.2.20.0140.00418.31
8.2.10.0130.00418.50
8.2.00.0130.00518.73
8.1.310.0080.00019.20
8.1.300.0030.00620.93
8.1.290.0030.00630.84
8.1.280.0110.01125.92
8.1.270.0060.00322.63
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0110.00723.16
8.1.230.0120.00819.99
8.1.220.0140.00618.36
8.1.210.0180.00318.92
8.1.200.0150.00518.28
8.1.190.0120.00718.22
8.1.180.0150.00418.29
8.1.170.0140.00618.65
8.1.160.0140.00518.39
8.1.150.0130.00618.52
8.1.140.0120.00718.10
8.1.130.0100.00918.20
8.1.120.0140.00418.08
8.1.110.0120.00718.50
8.1.100.0150.00318.56
8.1.90.0090.00518.12
8.1.80.0130.00418.13
8.1.70.0110.00518.09
8.1.60.0150.00318.15
8.1.50.0130.00518.32
8.1.40.0130.00718.32
8.1.30.0160.00518.26
8.1.20.0150.00518.23
8.1.10.0160.00518.13
8.1.00.0130.00818.15
8.0.300.0100.00519.70
8.0.290.0110.00718.03
8.0.280.0130.00518.15
8.0.270.0110.00717.83
8.0.260.0120.00517.84
8.0.250.0090.00918.23
8.0.240.0140.00417.83
8.0.230.0130.00517.86
8.0.220.0140.00417.79
8.0.210.0130.00417.76
8.0.200.0110.00717.81
8.0.190.0120.00417.98
8.0.180.0130.00517.71
8.0.170.0150.00317.71
8.0.160.0130.00517.74
8.0.150.0130.00417.71
8.0.140.0110.00617.83
8.0.130.0140.00317.44
8.0.120.0120.00517.26
8.0.110.0120.00517.27
8.0.100.0110.00617.27
8.0.90.0130.00417.27
8.0.80.0120.00617.32
8.0.70.0120.00517.34
8.0.60.0140.00417.23
8.0.50.0120.00517.22
8.0.30.0140.00517.33
8.0.20.0120.00717.38
8.0.10.0120.00617.36
8.0.00.0090.00817.44
7.4.330.0120.00217.30
7.4.320.0150.00417.74
7.4.300.0120.00417.52
7.4.290.0110.00517.46
7.4.280.0130.00417.49
7.4.270.0100.00617.47
7.4.260.0110.00617.48
7.4.250.0110.00617.00
7.4.240.0100.00617.07
7.4.230.0110.00617.00
7.4.220.0110.00616.98
7.4.210.0130.00317.08
7.4.200.0090.00717.02
7.4.190.0100.00616.96
7.4.180.0090.00716.94
7.4.160.0120.00517.00
7.4.150.0120.00616.95
7.4.140.0100.00817.16
7.4.130.0120.00616.97
7.4.120.0120.00517.03
7.4.110.0130.00416.93
7.4.100.0110.00616.98
7.4.90.0120.00516.94
7.4.80.0110.00617.09
7.4.70.0110.00716.97
7.4.60.0120.00517.02
7.4.50.0100.00717.02
7.4.40.0110.00616.93
7.4.30.0110.00617.00
7.4.20.0100.00716.99
7.4.10.0110.00716.94
7.4.00.0110.00617.16
7.3.330.0130.00417.00
7.3.320.0110.00616.53
7.3.310.0130.00516.79
7.3.300.0130.00516.78
7.3.290.0130.00516.82
7.3.280.0110.00716.82
7.3.270.0130.00416.80
7.3.260.0110.00716.89
7.3.250.0140.00516.88
7.3.240.0120.00716.92
7.3.230.0130.00516.86
7.3.220.0160.00316.82
7.3.210.0140.00516.88
7.3.200.0140.00616.86
7.3.190.0140.00616.86
7.3.180.0130.00616.87
7.3.170.0140.00516.89
7.3.160.0120.00716.91
7.3.150.0120.00616.91
7.3.140.0130.00616.89
7.3.130.0120.00716.92
7.3.120.0120.00716.78
7.3.110.0120.00716.73
7.3.100.0110.00716.68
7.3.90.0120.00616.80
7.3.80.0120.00716.67
7.3.70.0110.00716.63
7.3.60.0110.00616.65
7.3.50.0110.00716.66
7.3.40.0120.00716.69
7.3.30.0110.00716.66
7.3.20.0150.00617.15
7.3.10.0220.00617.15
7.3.00.0180.00717.09
7.2.340.0140.00617.01
7.2.330.0160.00517.09
7.2.320.0140.00517.02
7.2.310.0120.00917.08
7.2.300.0140.00617.02
7.2.290.0130.00717.08
7.2.280.0140.00617.09
7.2.270.0150.00617.11
7.2.260.0120.00817.10
7.2.250.0130.00717.07
7.2.240.0130.00817.00
7.2.230.0120.00816.95
7.2.220.0140.00616.95
7.2.210.0120.00816.83
7.2.200.0150.00716.88
7.2.190.0130.00716.90
7.2.180.0140.00616.90
7.2.170.0120.00816.90
7.2.160.0120.00816.88
7.2.150.0150.00817.45
7.2.140.0200.00717.44
7.2.130.0140.00717.49
7.2.120.0220.00717.37
7.2.110.0190.00617.33
7.2.100.0180.00717.33
7.2.90.0200.00717.37
7.2.80.0230.00717.34
7.2.70.0190.00717.38
7.2.60.0210.00717.36
7.2.50.0190.00717.35
7.2.40.0280.00717.45
7.2.30.0250.00717.40
7.2.20.0260.00717.38
7.2.10.0240.00917.37
7.2.00.0210.00817.42
7.1.330.0140.00716.80
7.1.320.0140.00716.73
7.1.310.0140.00716.56
7.1.300.0160.00616.54
7.1.290.0140.00716.51
7.1.280.0140.00616.58
7.1.270.0130.00716.55
7.1.260.0140.00816.50
7.1.250.0160.00616.33
7.1.240.0220.00716.25
7.1.230.0180.00716.27
7.1.220.0200.00516.27
7.1.210.0220.00716.23
7.1.200.0220.00716.26
7.1.190.0240.00616.25
7.1.180.0220.00716.18
7.1.170.0210.00716.19
7.1.160.0270.00716.22
7.1.150.0270.00816.27
7.1.140.0310.00616.30
7.1.130.0270.00616.25
7.1.120.0270.00716.23
7.1.110.0230.00716.32
7.1.100.0220.00816.36
7.1.90.0270.00716.30
7.1.80.0260.00716.38
7.1.70.0250.00616.24
7.1.60.0260.00717.50
7.1.50.0260.00917.48
7.1.40.0260.00617.48
7.1.30.0260.00917.48
7.1.20.0280.00817.45
7.1.10.0400.00716.28
7.1.00.0240.00716.23
7.0.330.0210.00616.06
7.0.320.0220.00716.16
7.0.310.0270.00616.08
7.0.300.0220.00516.13
7.0.290.0200.00716.16
7.0.280.0190.00616.10
7.0.270.0250.00616.17
7.0.260.0230.00716.17
7.0.250.0220.00616.25
7.0.240.0190.00716.23
7.0.230.0160.00616.25
7.0.220.0170.00716.22
7.0.210.0270.00616.24
7.0.200.0170.00716.21
7.0.190.0140.00816.24
7.0.180.0180.00616.27
7.0.170.0170.00716.29
7.0.160.0190.00616.21
7.0.150.0160.00816.18
7.0.140.0180.00516.19
7.0.130.0180.00616.21
7.0.120.0170.00616.23
7.0.110.0160.00716.25
7.0.100.0180.00516.23
7.0.90.0160.00616.12
7.0.80.0180.00716.24
7.0.70.0180.00616.22
7.0.60.0160.00716.22
7.0.50.0200.00516.19
7.0.40.0150.00716.24
7.0.30.0150.00716.25
7.0.20.0190.00816.19
7.0.10.0150.00816.25
7.0.00.0190.00616.22
5.6.400.0120.00816.26
5.6.390.0120.00816.24
5.6.380.0130.00716.05
5.6.370.0130.00816.18
5.6.360.0130.00916.22
5.6.350.0140.00716.24
5.6.340.0150.00616.21
5.6.330.0150.00616.18
5.6.320.0140.00616.22
5.6.310.0140.00716.24
5.6.300.0130.01016.26
5.6.290.0150.00816.39
5.6.280.0130.01016.36
5.6.270.0130.00916.36
5.6.260.0120.01016.39
5.6.250.0130.00916.40
5.6.240.0130.00916.41
5.6.230.0130.00916.43
5.6.220.0130.00916.43
5.6.210.0110.01116.43
5.6.200.0120.01016.52
5.6.190.0130.01116.46
5.6.180.0130.00916.44
5.6.170.0130.01016.49
5.6.160.0120.01016.42
5.6.150.0140.00916.47
5.6.140.0150.00816.46
5.6.130.0130.00916.50
5.6.120.0130.00916.47
5.6.110.0150.00916.40
5.6.100.0140.00816.43
5.6.90.0120.01016.36
5.6.80.0140.00816.29
5.6.70.0120.01016.39
5.6.60.0140.00916.37
5.6.50.0120.00916.30
5.6.40.0140.00816.34
5.6.30.0130.00816.33
5.6.20.0130.00916.13
5.6.10.0120.01016.13
5.6.00.0130.01016.12
5.2.170.0100.00516.05

preferences:
28.57 ms | 403 KiB | 5 Q