Re: [PHP] Linebreak

2006-04-21 Thread Jochem Maas

Martin Alterisio wrote:

You wouldn't feel/look stupid if you had RTFM:


no no thats not right - I RTFM all the time and still feel stupid ;-)


http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single


to to OP: do read up on strings some more (look for the word 'interpolation' and
make sure you know what it means).

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Linebreak

2006-04-21 Thread Richard Lynch
On Thu, April 20, 2006 9:47 pm, Peter Lauri wrote:
 I feel stupid.

 In many examples I have seen similar to:

 echo 'pWhatever./p\n';

 echo 'pAn other whatever./p\n';

 But my PHP outputs the \n instead of a new line in the source.

 I am stupid?

No, just naive. :-)

Quotes () and Apostrophes (') are not QUITE the same in PHP.

To some degree, they are VERY different.

' has only two (2) special characters:  ' and \

 has a lot of special characters, and interpolates variables and
one-dimension arrays.

\n only works in  not in '

Read this and you'll be WAY ahead of the game:
http://us2.php.net/manual/en/language.types.string.php

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Linebreak

2006-04-21 Thread Jochem Maas

Richard Lynch wrote:

On Thu, April 20, 2006 9:47 pm, Peter Lauri wrote:


I feel stupid.

In many examples I have seen similar to:

echo 'pWhatever./p\n';

echo 'pAn other whatever./p\n';

But my PHP outputs the \n instead of a new line in the source.

I am stupid?



No, just naive. :-)

Quotes () and Apostrophes (') are not QUITE the same in PHP.

To some degree, they are VERY different.

' has only two (2) special characters:  ' and \

 has a lot of special characters, and interpolates variables and
one-dimension arrays.


just to add: you can interpolate any dimension of arrays (and objects for that 
matter)
as long as you bother to escape the variables with braces inside the string
 e.g.

$str = my {$array['one']['two']['three']} string {$object-prop} 
interpolation;



\n only works in  not in '

Read this and you'll be WAY ahead of the game:
http://us2.php.net/manual/en/language.types.string.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Linebreak

2006-04-20 Thread Peter Lauri
I feel stupid.

 

In many examples I have seen similar to:

 

echo 'pWhatever./p\n';

echo 'pAn other whatever./p\n';

 

But my PHP outputs the \n instead of a new line in the source.

 

I am stupid?

 

 



Re: [PHP] Linebreak

2006-04-20 Thread Martin Alterisio
You wouldn't feel/look stupid if you had RTFM:
http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single

2006/4/20, Peter Lauri [EMAIL PROTECTED]:

 I feel stupid.



 In many examples I have seen similar to:



 echo 'pWhatever./p\n';

 echo 'pAn other whatever./p\n';



 But my PHP outputs the \n instead of a new line in the source.



 I am stupid?