Re: converting str with \n to one line str??
| From: | Tyler Longren | Date: | Mon, 20 Aug 2001 18:19:36 +0000 |
| Subject: | Re: converting str with \n to one line str?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-63546@lists.php.net to get a copy of this message | ||
You could use str_replace().
--
Tyler Longren
Captain Jack Communications
tyler@captainjack.com
www.captainjack.com
On Mon, 20 Aug 2001 20:15:54 +0200
"Jens" <nice@email.dk> wrote:
> When I use Javascript with PHP i run into one problem. When I get the
> data i
> need from the database it often has a lot of <br> and \n (new lines) in
> it.
> The <br> are no problem when converting a string to a Javascript string,
> but
> the \n are. The string has to be all in one line.
>
> example:
> <? $temp = "here
> I
> am"; ?>
>
> <script>var temp = <? echo $temp?> </script>
>
> This is not working!! But this would :
>
> <? $temp = "here I am"; ?>
>
> <script>var temp = '<? echo $temp?>'; </script>
>
> Can you help me please?
>
> thanks Jens
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net