PHP script newline on linux

linux, php

Solution

try this for linux:

echo 'hello world'."\n";

or this (works on any OS):

echo 'hello world'.PHP_EOL;

Problem

I usually use PHP to create dynamic web pages, now I need to write a script on linux that is similar to an old one I wrote for my website and I don't want to rewrite the whole thing in python. My problem is simple, I know that '\n' is the newline character for linux, but this doesn't work: ``` echo 'hello world\n'; ``` Any Ideas?

Original source

Related problems