CodeIgniter Forums
Write a newline to a file - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Write a newline to a file (/showthread.php?tid=5126)



Write a newline to a file - El Forum - 01-07-2008

[eluser]cinewbie81[/eluser]
Hi all, how to write a new line in a file ?? The following is my code:

Code:
$Content = '';
$Content = $Content.'123'.'\n';

Code above doesnt works for me, why ??
instead of newline, it print me '\n' into the file.. Anyone ?


Write a newline to a file - El Forum - 01-07-2008

[eluser]Josh Giese[/eluser]
try using double quotes


Write a newline to a file - El Forum - 01-07-2008

[eluser]cinewbie81[/eluser]
It's works now !! Thanks champion !!
and all this while, i thought single and double quotes act the same :p


Write a newline to a file - El Forum - 01-07-2008

[eluser]Josh Giese[/eluser]
glad to help, i think thats the first ting i have been able to answer on the forums.

double quotes will process the php code inside them, single quotes will give you the string literal.

there for:
echo "$blah"; and echo '$blah'; are not the same.