Forum Moderators: coopster

Message Too Old, No Replies

fwrite and newline?

         

pistol_pete

11:23 pm on Mar 31, 2004 (gmt 0)



Hi!
I'm trying to write a SVG file through a php using fwrite function, but the SVG I create does not contain newlines.
How can I include newlines with fwrite or other function?
Thanks!

WhosAWhata

2:22 am on Apr 1, 2004 (gmt 0)

10+ Year Member



add a \n
example:
$stuff1 = "line1";
$stuff2 = "line2";
fwrite($file, $stuff1."\n");
fwrite($file, $stuff2."\n");

OR

$stuff = array('line1','line2','line3');
$together = implode("\n",$stuff);
fwrite($file, $stuff);

coopster

4:06 pm on Apr 1, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, pistol_pete!

WhosAWhata has shown you some nice examples, here. Also, there are a number of escape sequences for special characters and you can see more of them in the PHP manual under String functions [php.net], including the newlines you ask of as well as tabs, carriage returns, etc.