I have a function that reads comments in a text file. Comment can last to end of line, if there is no end of line it lasts to end of file. My problem is I can't find out how to test it whether the end of file was reached. At first I had this:
while($char != "\n" && $char != false){
$char = fgetc($inputFile);
}
If there was 0
in a comment it ended the loop which I didn't want to. Then I tried this:
while($char != "\n" && !feof($inputFile)){
$char = fgetc($inputFile);
}
This broke up the whole program. I tried to google something but feof
and != false
is all I found.