PHP Linefeeds (\n) Not Working

Use double quotes. "test\n" will work just fine (Or, use 'test' . PHP_EOL).

If the string is enclosed in double-quotes (“), PHP will interpret more escape sequences for special characters:

http://php.net/manual/en/language.types.string.php

Leave a Comment