Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function tablazatok($filename){
- $file_contents = array();
- $ret = array();
- $f=fopen($filename, 'r');
- while ($line = fgets($f)){
- $line = rtrim(trim($line), ';');
- if (str_replace(';','',$line)=='') continue;
- $line_arr = explode(';', $line);
- if (isset($line_arr[0])){
- $file_contents[$line_arr[0]][] = array_slice($line_arr, 1);
- }
- }
- fclose($f);
- foreach ($file_contents as $tbl_name => $tbl){
- $ret_str = "<table><tr><th colspan=\"3\">{$tbl_name}</th></tr>";
- foreach ($tbl as $row){
- $ret_str .= "<tr>";
- foreach ($row as $val){
- $ret_str .= "<td>{$val}</td>";
- }
- $ret_str .= "</tr>";
- }
- $ret_str .= "</table>";
- $ret[] = $ret_str;
- }
- return $ret;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement