hello i met some problem when i use readfile function. i have a text file a.txt with the following content: 1234567 abcdefg ABCDEFG and i used readfile("a.txt") to read the file and print the content on the screen but i got: 1234567 abcdefg ABCDEFG but when i read the source file in browser it is: 1234567 abcdefg ABCDEFG so i suppose the browsers explain signal "\n" as a blank space and i should convert those "\n" to <br /> in the output html file. so i used nl2br function to do it: nl2br(readfile("a.txt")); but, still i got same issue, without seeing any <br /> in the browser source file. so i am really confused. anyone who can tell me how to get the correct result? thanks.
Not 100% sure what you ment but is this what your looking for? $filename = "file.txt"; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); fclose($handle); $contents = explode('/n', $contents); for ($content in $contents){ print $content . "<br />"; }