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:22

MS wrote:
> Im sure this must be quite easy to accomplish but I can not find the
> function/way to do it.
>
> MySQL Database field is saved as....
>
> "this is the text
>
> and has line breaks
>
> like this"
>
> Now I want to concat each line into a variable like this.
>
> "this is the text and has line breaks like this"
>
> I have tried trim() which supposedly takes out whitespace but its not
> working as I expect.
>
> What do I have to do?
>
> Thanks
>
>

<?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>";
?>

 

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

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