Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* $a = file_get_contents( "./directory.php_txt" );
- $a = str_replace( array( "\n" , "^|" ) , array( "[NEW*LINE]" , "[tAbul*Ator]" ) , $a );
- print "<table border=\"1\">";
- foreach( explode( "[NEW*LINE]" , $a ) AS $lines ) {
- print "<tr>";
- foreach( explode( "[tAbul*Ator]" , $lines ) AS $li ) {
- print "<td>";
- print $li ;
- print "</td>";
- }
- print "</tr>";
- }
- print "</table>"; */
- ?>
- <HTML>
- <HEAD>
- <TITLE> Example 6 </TITLE>
- </HEAD>
- <BODY><?
- // the following statement opens the files called output.txt
- // and reads each line of the file into an array called $readfile
- // Each line will be accessed by it's position in the array
- // $readfile[0] would be the first line because the array begins at 0
- // rather than 1
- $readfile = file("./directory.php_txt");
- // Create a loop that will read all elements of the array and print out
- // each field of the tab-delimited text file
- for ($k=0; $k<=count($readfile)-1; $k++) {
- $fields = explode("^|",$readfile[$k]);
- echo "<br>".$fields[1];
- }
- ?>
- </BODY>
- </HTML>
Add Comment
Please, Sign In to add comment