I'm working with PHP, and I would like to create a line-break in my .txt database after every input. Is this even possible and how? Please help, I have tried /n
and <br>
but these won't work. Some code:
fwrite($handle,$artikelnummer);
fwrite($handle,$newData);
Between these two I want a linebreak
Something like this?
fwrite($handle, $artikelnummer);
fwrite($handle, "
");
fwrite($handle, $newData);
As Shikhar Bhardwaj pointed out, you could use PHP_EOL, instead of " ", if you want to be completely OS platform independent...
UPDATE: If what you expect is one empty line between lines, you have to write 2 newlines...:
fwrite($handle, $artikelnummer);
fwrite($handle, PHP_EOL . PHP_EOL);
fwrite($handle, $newData);
You have to use Backslash and letter n in double-quotes:
fwrite($handle, "This is my text with a linebreak");
Use :
fwrite($file, $yourData . "
");
Don't use ' '
as PHP will not recognize the escape sequence then.
If you want to be platform independent use PHP_EOL
which outputs or
depending on the OS. Its a predefined constant. Look here.
If you want an empty line after writing a line :
fwrite($file, $yourData . PHP_EOL . PHP_EOL);