You are here: Re: An Easy One for you all « All PHP « IT news, forums, messages
Re: An Easy One for you all

Posted by Tyno Gendo on 04/07/07 16:27

Tyno Gendo wrote:
[snip]
> <?php
> $text="This is a line\r\nwith carriage\r\nreturns\r\nin it";
> echo "<pre>$text</pre>";
> $nocr=preg_replace("/\r\n/"," ",$text);
> echo "<pre>$nocr</pre>";
> ?>

Just thought, you may not have the \r as that's more a DOS thing anyway,
Unix will have just the \n, so you would need:

$nocr=preg_replace("/\r*\n/"," ",$text);

ie. zero or more "\r" rather than specifying it will have a \r\n as in
my previous post.

i'm not the most ingenious at regex, so anyone else have any comments on
this that would be great ;)

 

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

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