Quantcast

Forums | MacLife

You are not logged in.

#1 2004-12-18 9:32 am

iZach004
Member
From: Indianapolis, IN, 46240
Registered: 2001-06-04
Posts: 176
Website

Some PHP problems on OSX

I've been learning PHP recently and test the scripts with the web hosting on my Mac. I installed PHP and started up the web server, and most scripts run correctly.

However, I'm only learning and I've noticed a few errors with basic concepts that are quite frustrating. For starters, the "\n" command never works. Ever. <br /> works fine, but "\n" will not function. Nor will \t or \r. Yes, I'm aware of the difference between echo "xxx" and echo 'xxx'.

Any suggestions?

Thanks.

Offline

 

#2 2004-12-18 10:29 am

Alien
Forum Czar
Administrator
From: Republic of Amsterdam
Registered: 1999-07-05
Posts: 16942
Website

Re: Some PHP problems on OSX

To your browser, it's all whitespace. Unless you encapsulate the text in <pre></pre> tags, that is.

,xtG
.tsooJ


http://macstack.net/forums/images/smilies/lol.gif

Offline

 

#3 2004-12-18 10:31 am

zakatak
Member
From: Kalamazoo
Registered: 2004-08-05
Posts: 565

Re: Some PHP problems on OSX

real quick like... where are you trying to use the \n \t etc, to do? Are you trying to output into the HTML as a new line? because of the way that HTML is designed it won't work that way. But look at the source code that is rendered, it probably now has new lines where you said to put new lines...

make sure to remember how HTML outputs whitespace...

Offline

 

#4 2004-12-18 10:32 am

zakatak
Member
From: Kalamazoo
Registered: 2004-08-05
Posts: 565

Re: Some PHP problems on OSX

grrrrr... 2minutes.... grrrr....

Offline

 

#5 2004-12-19 8:17 am

sonjay
Member
From: The Hurricane State (Fla)
Registered: 2002-06-15
Posts: 82
Website

Re: Some PHP problems on OSX

Just to clarify for iZach, in case clarification is needed:

This:

Code:

echo "<br>"; 

will create a line break in your html output

This:

Code:

echo "\n"; 

will create a line break in your source code.

If you don't use newline characters liberally, your source code will a long, strung-together unreadable mess.

Offline

 

Board footer

Powered by PunBB 1.2.6
© Copyright 2002–2005 Rickard Andersson