
July 17th, 2005, 03:55 AM
| | | New Lines (\n) and Single Quotes
Is there anyway to make new lines in single quotes?
Thanks,
Jon Smith |

July 17th, 2005, 03:55 AM
| | | Re: New Lines (\n) and Single Quotes
On Tue, 03 Feb 2004 23:28:35 GMT, "Jon Smith" <jsmith@NOSPAM.earthlink.net>
wrote:
[color=blue]
>Is there anyway to make new lines in single quotes?[/color]
$answer = 'yes,
there is.';
--
Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space> | 
July 17th, 2005, 03:56 AM
| | | Re: New Lines (\n) and Single Quotes
Jon Smith wrote:[color=blue]
> Is there anyway to make new lines in single quotes?
>
> Thanks,
>
> Jon Smith[/color]
No, not that I'm aware of :)
you can try:
<?php
define('LF', "\n"); // or 'NL' or 'NewLine' or 'LineFeed' or ...
echo 'first line', LF, 'second line';
// avoids (lol)
// echo "first line\nsecond line";
// or
// echo 'first line', "\n", 'second line';
?>
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =-- | 
July 17th, 2005, 03:56 AM
| | | Re: New Lines (\n) and Single Quotes
Andy Hassall wrote:[color=blue]
> On Tue, 03 Feb 2004 23:28:35 GMT, "Jon Smith" <jsmith@NOSPAM.earthlink.net>
> wrote:
>[color=green]
>>Is there anyway to make new lines in single quotes?[/color]
>
> $answer = 'yes,
> there is.';[/color]
Ah! I felt like I was missing something :-)
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =-- | 
July 17th, 2005, 03:56 AM
| | | Re: New Lines (\n) and Single Quotes
On Tue, 03 Feb 2004 23:28:35 GMT, "Jon Smith"
<jsmith@NOSPAM.earthlink.net> wrote:
[color=blue]
>Is there anyway to make new lines in single quotes?
>
>Thanks,
>
>Jon Smith
>[/color]
You can break single-quoted strings (and double-quoted, for that
matter) over multiple lines.
Ex:
<?php
$string =
'This is
a string
with newlines!';
?>
But if you mean using the literal character(s) \n, then you'd have to
do it like:
<?php
$string = 'This is' . "\n" . 'a string' . "\n" . 'with newlines!';
?>
Which one is easier to read for you? ;) | 
July 17th, 2005, 03:56 AM
| | | Re: New Lines (\n) and Single Quotes
Thanks for the help, I thought that was the only way...
JS
"auntie social" <no@thanks.sucker> wrote in message
news:g5f0209sbcaui4njt0bt2rdrd2ntl66mud@4ax.com...
| On Tue, 03 Feb 2004 23:28:35 GMT, "Jon Smith"
| <jsmith@NOSPAM.earthlink.net> wrote:
|
| >Is there anyway to make new lines in single quotes?
| >
| >Thanks,
| >
| >Jon Smith
| >
|
| You can break single-quoted strings (and double-quoted, for that
| matter) over multiple lines.
|
| Ex:
|
| <?php
|
| $string =
| 'This is
| a string
| with newlines!';
|
| ?>
|
| But if you mean using the literal character(s) \n, then you'd have to
| do it like:
|
| <?php
|
| $string = 'This is' . "\n" . 'a string' . "\n" . 'with newlines!';
|
| ?>
|
| Which one is easier to read for you? ;)
| | | Thread Tools | Search this Thread | | | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 205,414 network members.
|