web hosting and development forums
Web Design and Development Forums Archive


Index - PHP programming forum

Adding a new line character in a string


Post reply

Hello.
I'm trying to add a newline character in a string but it doesn work, please help
here is the code:
[code:1]$var1= variable1;
$var2= variable2;
$message = $var1 . '\n\n results:' . $var2;[/code:1]
The result i get is:
[code:1]variable1nn results:variable2[/code:1]
and i need this result:
[code:1]variable1
results:variable2[/code:1]
Thank you in advance!!!
Try using dual quotes instead of one quote like this:
"\n" instead of '\n'
your example should look like:
[code:1]$var1= variable1;
$var2= variable2;
$message = $var1 . "\n\n results:" . $var2;[/code:1]




Dubai Forum | Paris Forum | Webmaster Forum | Vegan Forum | Brisbane Forum | 3D Forum | Jobs in Dubai | Jobs in London | London UK Classifieds
Archive script by RedHo.com