You are here: Carriage returns « PHP Programming Language « IT news, forums, messages
Carriage returns

Posted by Dan Pearce on 06/21/06 15:15

I am formatting a plain text file into HTML and trying to find the
carriage returns with little success...

<?php
$s = file_get_contents('./test.txt')
$search = array ('\n\n');
$replace = array ('<p></p>');
echo preg_replace($search, $replace, $s);
?>

I have also tried \n, \r, \n\r etc... in place of \n\n but to no avail.


Can anyone help me with this? I know text files aren't an ideal format
and a database would be easier, but the site will be used by people
with no computer knowledge what so ever, and it is easier to show them
how to use notepad :¬)

Thanks in advance

Dan

 

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

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