3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<'TAG' <html> <body> <table class="searchTable" cellspacing="0" cellpadding="5" style="width: 100%;"> <tbody> <tr> <th>Book</th> <th>Model Name</th> <th>Description</th> <th>Category</th> </tr> <tr> <td> <a onclick="getFullData( '', 'K0074', 'B2004' );" href="">K0072</a> </td> <td>B2004</td> <td>K0074 Description</td> <td>K0074 Category</td> </tr> </tbody> </table> </body> </html> TAG; $doc = new DOMDocument(); $doc->loadHTML($html); $tables = $doc->getElementsByTagName('table'); foreach ($tables as $table) { if ($table->getAttribute('class') !== 'searchTable') { continue; } $rows = $table->getElementsByTagName('tr'); foreach ($rows as $row) { $cells = $row->getElementsByTagName('td'); // Sanity check that we have four rows or skip it if (4 !== count($cells)) { continue; } // Sanity check that the first cell has a link inside it $firstCellLinks = $cells[0]->getElementsByTagName('a'); if (1 !== count($firstCellLinks)) { continue; } // Make sure the first link has an onclick attribute if (!$firstCellLinks[0]->hasAttribute('onclick')) { continue; } // Finally, get the contents of the cell. This can be simplified to a one-line but // I've expanded it to be more obvious. $firstCellLinkOnClick = $firstCellLinks[0]->attributes['onclick']->value; $firstCellLinkOnClickParamsAsString = preg_replace('/getFullData\(([^)]+)\);/', '$1', $firstCellLinkOnClick); $firstCellLinkOnClickParamsAsArray = str_getcsv($firstCellLinkOnClickParamsAsString, ',', "'"); print_r($firstCellLinkOnClickParamsAsArray); /* Array ( [0] => [1] => K0074 [2] => B2004 ) */ } }

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.5.10.0090.00919.00
8.5.00.0140.00820.35
8.4.150.0030.00014.05
8.4.140.0100.01218.30
8.4.130.0080.01219.08
8.4.120.0120.00820.78
8.4.110.0110.00720.79
8.4.100.0110.00919.12
8.4.90.0120.00820.77
8.4.80.0110.01118.32
8.4.70.0130.00918.13
8.4.60.0140.00619.14
8.4.50.0110.00818.39
8.4.40.0180.00318.35
8.4.30.0120.00320.84
8.4.20.0080.00820.18
8.4.10.0060.01318.32
8.3.280.0160.00918.63
8.3.270.0100.01016.88
8.3.260.0130.00716.98
8.3.250.0060.01217.39
8.3.240.0130.00816.92
8.3.230.0120.00816.84
8.3.220.0140.00517.38
8.3.210.0040.00518.76
8.3.200.0040.00417.09
8.3.190.0110.00819.14
8.3.180.0100.00916.92
8.3.170.0090.00920.82
8.3.160.0000.00817.47
8.3.150.0130.00717.20
8.3.140.0050.00517.05
8.3.130.0040.00417.01
8.3.120.0130.00319.16
8.3.110.0100.00620.94
8.3.100.0080.00024.06
8.3.90.0120.00326.77
8.3.80.0000.00916.88
8.3.70.0130.00317.00
8.3.60.0130.00318.80
8.3.50.0140.00018.30
8.3.40.0180.00322.20
8.3.30.0180.00319.16
8.3.20.0040.00424.18
8.3.10.0000.00824.66
8.3.00.0040.00426.16
8.2.290.0090.01420.54
8.2.280.0140.00518.80
8.2.270.0100.01017.67
8.2.260.0120.00617.28
8.2.250.0130.00318.89
8.2.240.0040.00417.22
8.2.230.0030.00622.58
8.2.220.0000.00937.54
8.2.210.0000.00826.77
8.2.200.0000.01217.00
8.2.190.0120.00617.00
8.2.180.0110.00825.92
8.2.170.0040.01119.41
8.2.160.0130.00022.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0030.00521.48
8.2.110.0070.00322.53
8.2.100.0040.00818.22
8.2.90.0040.00418.28
8.2.80.0030.00519.42
8.2.70.0000.00818.13
8.2.60.0050.00318.00
8.2.50.0000.00818.18
8.2.40.0070.00320.13
8.2.30.0000.00818.03
8.2.20.0040.00418.45
8.2.10.0030.00720.97
8.2.00.0080.00019.50
8.1.330.0070.00422.31
8.1.320.0100.01116.70
8.1.310.0110.00716.91
8.1.300.0090.00016.51
8.1.290.0030.00618.88
8.1.280.0120.00625.92
8.1.270.0040.00424.07
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0030.00623.95
8.1.230.0100.00321.09
8.1.220.0060.00318.14
8.1.210.0060.00319.15
8.1.200.0030.00617.72
8.1.190.0080.00417.47
8.1.180.0030.00518.10
8.1.170.0040.00417.90
8.1.160.0040.00419.07
8.1.150.0050.00219.06
8.1.140.0050.00320.90
8.1.130.0030.00319.09
8.1.120.0050.00317.82
8.1.110.0000.00817.88
8.1.100.0000.00717.70
8.1.90.0000.00717.82
8.1.80.0030.00617.86
8.1.70.0030.00317.81
8.1.60.0040.00418.00
8.1.50.0050.00517.89
8.1.40.0000.00817.79
8.1.30.0030.00517.90
8.1.20.0050.00618.01
8.1.10.0030.00617.90
8.1.00.0060.00317.89
8.0.300.0040.00420.52
8.0.290.0040.00417.25
8.0.280.0000.00818.39
8.0.270.0050.00217.19
8.0.260.0000.00618.75
8.0.250.0030.00617.43
8.0.240.0070.00017.36
8.0.230.0030.00417.36
8.0.220.0040.00417.29
8.0.210.0000.00717.37
8.0.200.0030.00317.45
8.0.190.0050.00317.39
8.0.180.0040.00417.34
8.0.170.0090.00017.37
8.0.160.0040.00417.17
8.0.150.0000.00717.38
8.0.140.0040.00417.33
8.0.130.0030.00313.74
8.0.120.0030.00617.23
8.0.110.0030.00617.45
8.0.100.0090.00017.45
8.0.90.0050.00317.24
8.0.80.0040.00417.20
8.0.70.0030.00717.32
8.0.60.0030.00617.45
8.0.50.0030.00517.44
8.0.30.0040.00417.36
8.0.20.0040.00417.39
8.0.10.0030.00517.46
8.0.00.0000.00717.27
7.4.330.0030.00315.55
7.4.320.0060.00016.95
7.4.300.0060.00017.05
7.4.290.0040.00416.87
7.4.280.0080.00017.12
7.4.270.0030.00516.97
7.4.260.0000.00513.71
7.4.250.0070.00017.02
7.4.240.0020.00516.94
7.4.230.0030.00317.03
7.4.220.0070.00017.15
7.4.210.0070.00016.79
7.4.200.0040.00416.98
7.4.190.0050.00217.12
7.4.180.0030.00316.87
7.4.160.0040.00416.79
7.4.150.0030.00317.06
7.4.140.0000.00717.07
7.4.130.0070.00016.73
7.4.120.0000.00717.08
7.4.110.0000.00816.80
7.4.100.0000.00817.15
7.4.90.0050.00317.07
7.4.80.0040.00417.04
7.4.70.0050.00316.73
7.4.60.0000.00716.88
7.4.50.0000.00816.97
7.4.40.0000.00716.88
7.4.30.0050.00317.15
7.4.20.0030.00516.77
7.4.10.0040.00416.89
7.4.00.0000.00817.00
7.3.330.0030.00516.75
7.3.320.0050.00013.50
7.3.310.0030.00316.85
7.3.300.0030.00316.66
7.3.290.0030.00516.73
7.3.280.0080.00016.85
7.3.270.0000.00716.75
7.3.260.0000.00716.63
7.3.250.0030.00316.67
7.3.240.0000.00716.63
7.3.230.0030.00316.70
7.3.220.0050.00316.66
7.3.210.0000.00716.87
7.3.200.0000.00816.52
7.3.190.0030.00316.76
7.3.180.0030.00316.86
7.3.170.0070.00016.57
7.3.160.0000.00816.57
7.3.150.0070.00016.56
7.3.140.0030.00316.76
7.3.130.0030.00316.57
7.3.120.0070.00016.55
7.3.110.0000.00716.66
7.3.100.0030.00316.80
7.3.90.0070.00016.95
7.3.80.0000.00816.64
7.3.70.0040.00416.62
7.3.60.0030.00516.66
7.3.50.0030.00316.80
7.3.40.0050.00316.84
7.3.30.0030.00516.68
7.3.20.0040.00416.81
7.3.10.0030.00616.83
7.3.00.0050.00316.68

preferences:
35.85 ms | 403 KiB | 5 Q