Posted by Davide on 03/24/07 09:49
On 24 Mar, 09:39, "Davide" <davide.papa...@gmail.com> wrote:
> sorry.. this is the correct one:
>
> $pizza = "/var/www/foo.txt";
> $lines = file('/var/www/foo.txt');
> foreach ($lines as $line_num => $line) {
> htmlspecialchars($line) . "<br />\n";
> $pieces = explode(" ", htmlspecialchars($line) . "<br />\n");
> echo $pieces[0]; // piece1
> echo $pieces[1]; // piece2
> }
>
> it echoes only the first line of the file
>
> pippo pluto
Ok.. I solved...
It was the space in <br />
$pizza = "/var/www/foo.txt";
$lines = file('/var/www/foo.txt');
foreach ($lines as $line_num => $line) {
htmlspecialchars($line) . "<br>\n";
$pieces = explode(" ", htmlspecialchars($line) . "<br>\n");
echo $pieces[0]; // piece1
echo $pieces[1]; // piece2
}
[Back to original message]
|