redho home | products | services

Programming Forums


Community for Java, PHP, Perl C, ASP and Python programmers
Friday 03 September 2010 04:45

Ask your IT question here

Adding a new line character in a string



 
Post new topic   Reply to topic    Programming Forums -> PHP programming forum
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
 
Page 1 of 1
Post new topic   Reply to topic    Programming Forums -> PHP programming forum


Dubai Forums - Expat Help | Vegan Forum | Java Programming | 3d Design Resources | 3d Forum | 3D Jobs | 3D Textures | Paris Forum | Europe Forum
Dubai Classifieds | Dubai Property | Jobs in Dubai | Free London Classifieds | Jobs in London UK

High Quality, Custom 3d animation and Web Design solutions Royal Quality Web Hosting Services Vegetarian and Animal Rights news

Based on phpBB © 2001-2010 RedHo