You are here: Re: Too many line breaks !? « All PHP « IT news, forums, messages
Re: Too many line breaks !?

Posted by Stefan Rybacki on 01/08/06 16:32

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Pete wrote:
>> The problem is your "\n", since $arr2[$i] already seem to contains the
>> line end
>> character.
>
> Thanks. I guess it reads a "\n" from the file too. It thought "\n" worked as
> a seperator for the file_lines array:
> $file_lines = file($filename);
>
> Is there any way to read each line in the file into an array without the
> line break at the end of each line?

if you just need one line at a time you could use fopen in combination with
fgets and trim to remove the ending linebreak.
If you want to go ahead with the array you got from file() you can trim those
lines as well using trim()

Regards
Stefan

>
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1rc2 (MingW32)

iD8DBQFDwSJ9yeCLzp/JKjARArvUAJ0WUih/2Bn8PllfMRfXUiYq0zCNsACcDZ3e
Ht7/XyGKiu8KG/rCFDEbcSw=
=F4E9
-----END PGP SIGNATURE-----

 

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

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