This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
1vannn's profile picture

[PHP] New Line when creating file?

Started by 1vannn, 22 June 2013 - 08:22 PM
1vannn #1
Posted 22 June 2013 - 10:22 PM
I'm making a multi line file that needs to be creating multiple lines, however, I'm not sure how to do it. Here is the line of code.

file_put_contents("teams/$teamCreate/info.txt","$teamCreate\n$adminEmail\n$password");
Skydyn #2
Posted 22 June 2013 - 10:32 PM
You could use "\r\n", but that's not good for cross-platform compatibility. (I'll give a more in-depth explanation if you like.) Instead, use PHP_EOL like so:

"first line".PHP_EOL."second_line"
1vannn #3
Posted 22 June 2013 - 10:41 PM
You could use "\r\n", but that's not good for cross-platform compatibility. (I'll give a more in-depth explanation if you like.) Instead, use PHP_EOL like so:

"first line".PHP_EOL."second_line"
Thanks Skydyn! it works! :D/>
theoriginalbit #4
Posted 22 June 2013 - 10:58 PM
You could use "\r\n", but that's not good for cross-platform compatibility.
But it is much better than just using '\n' or '\r'.