// html form each line into csv format array
<?
function get_tr_array ($ table) {
// php tutorial open source code
$ table = preg_replace ("'<td [^>] *?>' si ',' '', $ table);
$ table = str_replace ("</ td>", '",', $ table);
$ table = str_replace ("</ tr>", "{tr}", $ table); // Open Source osphp.com.cn
// remove the html tag
$ table = preg_replace ("'<[/!] *? [^ <>] *?>' si", "", $ table);
// remove whitespace characters
$ table = preg_replace ("'([rn]) [s] +'", "", $ table);
$ table = str_replace ("", "", $ table);
$ table = str_replace ("", "", $ table);
$ table = explode (", {tr}", $ table);
array_pop ($ table);
return $ table;
}
?>
// Convert each column of the html table into an array and collect the table data
<?
function get_td_array ($ table) {
$ table = preg_replace ("'<table [^>] *?>' si", "", $ table);
//osphp.com.cn
$ table = preg_replace ("'<tr [^>] *?>' si", "", $ table);
$ table = preg_replace ("'<td [^>] *?>' si", "", $ table);
$ table = str_replace ("</ tr>", "{tr}", $ table); // Open Source osphp.com.cn
$ table = str_replace ("</ td>", "{td}", $ table);
// remove the html tag
$ table = preg_replace ("'<[/!] *? [^ <>] *?>' si", "", $ table); //osphp.com.cn Open Source
// remove whitespace characters
$ table = preg_replace ("'([rn]) [s] +'", "", $ table);
$ table = str_replace ("", "", $ table);
$ table = str_replace ("", "", $ table);
$ table = explode ('{tr}', $ table);
array_pop ($ table); // php open source
foreach ($ table as $ key => $ tr) {
$ td = explode ('{td}', $ tr);
array_pop ($ td);
$ td_array [] = $ td; //}
return $ td_array;
}
?>