On Fri, 2004-08-06 at 13:24, Jed R. Brubaker wrote:
> Hey all! Glad you are here.
>
> I have a question that is confusing me a bit. I am trying to output a string
> that is pulled from a database that I don't have control over.
>
> Everything is great, except that the string needs to be all on one line with
> no line breaks (for Javascript's sake). Is there a function in PHP to make
> sure that output is on one line, regardless of the content of the line?
>
> Below are some examples of the data.
> Thanks in advance!
>
> MySQL (text)
> ----------------------
> Here is some text, and here is the MySQL field is a line break.
>
> Here is more text that is still part of the text above.
> ----------------------
>
>
> Needed output (w/ no whitespace)
> ----------------------
> Here is some text, and here is the MySQL field is a line break. Here is more
> text that is still part of the text above.
> ----------------------
This usually works of for me:
$text = ereg_replace( '[[:space:]]+', ' ', $text );
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php