|
Adding a new line character in a string
|
| View previous topic :: View next topic |
| Author |
Message |
Victor Guest Programmer
|
Hello.
I'm trying to add a newline character in a string but it doesn work, please help
here is the code:
| Code: |
$var1= variable1;
$var2= variable2;
$message = $var1 . '\n\n results:' . $var2; |
The result i get is:
| Code: |
| variable1nn results:variable2 |
and i need this result:
| Code: |
variable1
results:variable2 |
Thank you in advance!!!
Reply with quote
|
| |
|
|
Coder Guest Programmer
|
Try using dual quotes instead of one quote like this:
"\n" instead of '\n'
your example should look like:
| Code: |
$var1= variable1;
$var2= variable2;
$message = $var1 . "\n\n results:" . $var2; |
Reply with quote
|
| |
|
|
|