Hi there,
it seems as if fgets puts a space after everything it returns. Here's some example code:
<?php
Echo "Opening " . $_SERVER{'DOCUMENT_ROOT'} . "/file.txt" . "...<br>";
$FileHandle = @Fopen($_SERVER{'DOCUMENT_ROOT'} . "/file.txt", "r");
If ($FileHandle){
Echo "File opened:<br><br>";
While (!Feof($FileHandle)){
$Line = Fgets($FileHandle);
Echo $Line . "word<br>"; //Should be LINECONTENTSword, no space.
}
Fclose($FileHandle);
}
?>
which returns
Opening /var/www/vhosts/cqe.me/httpdocs/file.txt...
File opened:
First line word
Second line word
3rd line word
Another line of text word
Blablablaword
Why is there a space between the line's content and "word"? And why is this space not there at the end of the file (Blablablaword)?
Could you please tell me how to get rid of this space? Thanks a lot :-)!