You are here: Re: Line count/blank line issue with file(), etc. « All PHP « IT news, forums, messages
Re: Line count/blank line issue with file(), etc.

Posted by J.O. Aho on 12/27/05 12:29

Curtis wrote:
> When reading in text files, if the file has a blank line
> following text, but no text, it is apparently being ignored
> on a file() call:

No, this ain't a file() issue but the way HTML works.

change this
> $lines = file($filename);
> echo count($lines);

to

?>
<pre>
<?PHP
$lines = file($filename);
echo count($lines);
?>
</pre>
<?PHP



> A space in the last blank line makes the count correct.

HTML don't respect linebreaks, you need to change those to <br> nl2br(9 can do
that for your. Another way is to make the output between <pre></pre>.


//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация