Reputation: 709
I have this piece of code and for some reason the escape sequences are not working... what could be the problem?
$handle = fopen("TransLoc.txt", "r");
if($handle){
while(($buffer = fgets($handle)) != false){
echo "hahahahah\t";
echo $buffer."\n";
}
fclose($handle);
}
Upvotes: 0
Views: 1866
Reputation: 849
that function adds a br tag to every newline in the output
try it if you use your function inside an html body
Upvotes: 1
Reputation: 60007
You could also set the header for content type to text/plain having the following line in your code before sending any other data to the browser
Header('Content-type: text/plain');
If you are just want to send plain text. Otherwise followin @KingCrunch advice.
EDIT
@KingCrunch has added the text/plain whilst I was typing in my answer!
Upvotes: 0
Reputation: 131891
You probably call this script from a webserver with your browser. In fact the newline appears in the output, but browser don't render them. Look at the source of the page you called and you will see them.
If you want to get a "html"-newline, use <br/>
. Or if you don't want to send HTML, use
header('Content-Type: text/plain');
for example
Upvotes: 3