Re: outputting a carriage return
| From: | Curt Zirzow | Date: | Thu, 17 Jul 2003 15:29:47 +0000 |
| Subject: | Re: outputting a carriage return | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-155635@lists.php.net to get a copy of this message | ||
bob pilly <bobpilly@yahoo.co.uk> wrote:
> Hi all
> Can someone tell me why if i echo a line like this:
>
>
> echo "this is a \n newline";
> the output is:
> this is a
> newline.
>
> But if i do this: $text="this is a \n newline";
> echo $text;
> the output is:
> this is a newline?
works fine for me.
>
> Is there something i have to do to a variable in order for echo or print to treat special chars
> like '\n' correctly?
>
nope. as long as the \n is inside " quotes then it will get treated as a
new line.