There is php code:
#!/usr/bin/php
<?php
if ($file = fopen("file.txt", "r")) {
while(!feof($file)) {
$line = fgets($file);
echo "----" , $line , "----";
}
fclose($file);
}
?>
and empty file "file.txt"
[root@localhost]# ls -l file.txt
-rw-r--r-- 1 root root 0 Апр 21 10:14 file.txt
[root@localhost]# file file.txt
file.txt: empty
Why i get ? feof should be true in first loop or am i wrong?
[root@localhost ]# php -f test2.php
--------
[root@localhost ]#