Re: Reading A file
| From: | Ing. Fernando Proll Segura | Date: | Wed, 06 Mar 2002 14:12:44 +0000 |
| Subject: | Re: Reading A file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-87460@lists.php.net to get a copy of this message | ||
> Hey
>
> I have a TEXT file that I want to make visual via the web using php
>
>
>
Maybe this isn't the best way but to do this I use the following code:
<?php
function do_print($item2,$clave) {
echo $item2."<BR>";
}
$lines=file("yourfile.txt");
array_walk($lines,'do_print');
?>
As you can see I use the file() function to get each line of text into an
array and then the function array_walk() to do the visualization.
Hope it helps!
Fernando