special character "\n" seems didnt work

hello everybody
Im a beginer, just wrote this script and it seems that special character didnt work:

<?php $number = 10; $string1 = "There are '$number' people in line."; $string2 = 'There are "$number" people waiting.'; echo $string1."\n"; echo $string2; $variable = "you \n me"; echo $variable; ?>

My browser outputs this:

There are ‘10’ people in line. There are “$number” people waiting.you me

It seems that PHP didnt recognize new line character.
Please help me to solve this problem.
Thank you

Hi there,

Any time you want to use a special notation like \t, \n, or \r, you must enclose it in single quotes not double quotes.

[php]<?php

$number = 10;
$string1 = “There are ‘$number’ people in line.”;
$string2 = ‘There are “$number” people waiting.’;
echo $string1.’\n’;
echo $string2;

$variable = ‘you \n me’;
echo $variable;

?>[/php]

Try this code that I modified for you.

Hope this helps.

Sponsor our Newsletter | Privacy Policy | Terms of Service