Search code examples
unixend-of-line

Add unix end of line


Let's say I want to create a line that I would put in a unix file.

if it was windows, in the php program, I would write :

 $line .= '\r\n';

What would I write for unix to have unix end of line and go to the next line?

How can I make it work for any environment ?

Thank you


Solution

  • In unix you would simply use $line .= '\n'; as \n is the character that defines a new line.