Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #3264
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Question about new lines |
| Date | 2011-10-02 16:21 +0100 |
| Organization | albasani.net |
| Message-ID | <j69vhh$9ji$3@news.albasani.net> (permalink) |
| References | <4e886e7b$0$5356$9a566e8b@news.aliant.net> |
Linus Flustillbe wrote:
> I come from a scripting background so am not unfamiliar
> with the concept of CR/LF characters. I am in the process
> of learning PHP via the following tutorial
>
> http://mobilitystudies.com/mob/images/stories/PHP_Tutorial_From_beginner_to_master.pdf
>
> Currently I have "hello.php" with the following lines of code
>
> -------------------------
> <html>
> <body>
> <?php
> $d=date("D");
> if ($d=="Fri")
> echo "Have a nice weekend!";
> elseif ($d=="Sun")
> echo "Have a nice Sunday!";
> else echo "Have a nice day!";
> echo "\nhello boss"."\t"."does this work".PHP_EOL;
> echo "again";
> ?>
> </body>
> </html>
> ---------------------------------
> When I load this in my browser I see the following
> ------------------------
> Have a nice Sunday! hello boss does this work again
> -------------------------
> And if I look at the page source (using Firefox)
> --------------------------
> <html>
> <body>
> Have a nice Sunday!
> hello boss does this work
> again</body>
> </html>
> ------------------------
> Should the "\n" not push a NewLine out to the output?
> I did some research and found that the PHP_EOL seems to be what is
> recommended since it is platform independant. But it doesn't work
> either.
>
> Can anyone suggest or point out what I am doing wrong, or is this a flaw
> in php?
>
No, its a flaw in your understanding of HTML which does not recognise
white space including new lines.
use <BR> instead.
> Thanks
>
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Question about new lines Linus Flustillbe <admin@nacs.dyndns-office.com> - 2011-10-02 14:00 +0000
Re: Question about new lines "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> - 2011-10-02 14:17 +0000
Re: Question about new lines Linus Flustillbe <admin@nacs.dyndns-office.com> - 2011-10-02 16:36 +0000
Re: Question about new lines "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> - 2011-10-02 21:58 +0000
Re: Question about new lines The Natural Philosopher <tnp@invalid.invalid> - 2011-10-03 05:35 +0100
Re: Question about new lines "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> - 2011-10-03 07:53 +0000
Re: Question about new lines Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-03 11:40 +0200
Re: Question about new lines Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-03 07:26 -0400
Re: Question about new lines "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> - 2011-10-03 11:42 +0000
Re: Question about new lines Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-03 08:48 -0400
Re: Question about new lines "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> - 2011-10-03 13:05 +0000
Re: Question about new lines Robert Heller <heller@deepsoft.com> - 2011-10-03 08:49 -0500
Re: Question about new lines "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> - 2011-10-03 14:11 +0000
Re: Question about new lines Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-03 10:57 -0400
Re: Question about new lines "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> - 2011-10-03 15:14 +0000
Re: Question about new lines Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-03 14:57 -0400
Re: Question about new lines Mason Barge <masonbarge@gmail.com> - 2011-10-05 15:20 -0400
Re: Question about new lines Tim Streater <timstreater@greenbee.net> - 2011-10-06 12:27 +0100
Re: Question about new lines Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-03 10:54 -0400
Re: Question about new lines Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-03 14:51 +0200
Re: Question about new lines Tim Streater <timstreater@greenbee.net> - 2011-10-06 12:21 +0100
Re: Question about new lines The Natural Philosopher <tnp@invalid.invalid> - 2011-10-02 16:21 +0100
Re: Question about new lines Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-02 11:43 -0400
Re: Question about new lines Denis McMahon <denismfmcmahon@gmail.com> - 2011-10-02 19:08 +0000
Re: Question about new lines "Peter H. Coffin" <hellsop@ninehells.com> - 2011-10-02 19:57 -0500
Re: Question about new lines Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2011-10-02 23:52 +0200
Re: Question about new lines Gordon Burditt <gordon@hammy.burditt.org> - 2011-10-03 00:15 -0500
Re: Question about new lines Michael Joel <no@please.com> - 2011-10-04 09:38 -0400
csiph-web