You are here: Trouble with file() and rtrim « All PHP « IT news, forums, messages
Trouble with file() and rtrim

Posted by Ridge Burner on 08/03/05 16:51

I have a text file with the following lines:

line1
line2
line3
line4
line5

And the following script:

<?
$line = file("builder2.txt");
foreach($line as $field){
rtrim($field, "\n\r");
echo "'".$field."', ";
}
?>
which returns:

'line1 ', 'line2 ', 'line3 ', 'line4 ', 'line5',

when it should return:

'line1', 'line2', 'line3', 'line4', 'line5',

I've tried using the ASCII references also, without effect.
I cannot seem to strip the newline off!
Any help would be appreciated!

--Ridge

 

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

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