The example in this article describes how PHP can be used as an array to collect tabular data for each column of HTML tables. Share to everyone for your reference. Specifically as follows:
The following PHP code can be used to convert each row of HTML tables into an array, collecting tabular data
<?php
function Get_td_array ($table) {
$table = preg_replace ("' <table[^>]*?> ' si", "", $table);
$table = Preg_replace ("' <tr[^>]*?> ' si", "", $table);
$table = Preg_replace ("' <td[^>]*?> ' si", "", $table);
$table = Str_replace ("</tr>", "{tr}", $table);
$table = Str_replace ("</td>", "{td}", $table);
Remove HTML tags
$table = preg_replace ("' <[/!] *? [^<>]*?> ' Si ', "", $table);
Remove the white space character
$table = Preg_replace ([rn]) [s]+ ' "," ", $table);
$table = Str_replace ("", "", $table);
$table = Str_replace ("", "", $table);
$table = Explode (' {tr} ', $table);
Array_pop ($table);
foreach ($table as $key => $tr) {
$td = explode (' {TD} ', $TR);
Array_pop ($TD);
$TD _array[] = $td;
}
return $TD _array
}
? >