PHP – reads text file without new line character

If you’re trying to read text file with file() function (or something similar) and it returns file content without new line recognition probably php configuration is set to not detect line endings. To avoid this (if anything else does not solve your problem) you can use ini_set() in your PHP script – as follow:

This should do the trick.

One thought on “PHP – reads text file without new line character

Leave a Reply