Mar 10
31
Printing a new line witch is visible in a web page is made like this:
-
echo(‘line 1′.
‘\n‘.
‘line 2′);
-
the code above will print line 1 on a line and line 2 on a new line.
Now if you have to generate a CSV file <br/> wil not work you have to use \n like in C language but there is a trick.
-
echo (‘line 1 \n line 2′);
//will print something like line 1 \n line 2
-
echo("line 2 \n line 2");
// will print line 1 on the first line and line 2 on the second line
double quotes will parse \n as a new line and single quotes will believe is is a text
Tags: cvs, new line, php
This entry was posted
on March 31, 2010 at 9:52 pm. You can follow any responses to this entry through the RSS 2.0 feed.
Both comments and pings are currently closed.
Posted in PHP & MySQL by admin