() Fungsi PHP feof
Definisi dan Penggunaan
Apakah feof () pemeriksaan fungsi telah mencapai akhir dari file (EOF).
Jika terjadi kesalahan, atau file pointer ke akhir file (EOF) mengembalikan TRUE, jika tidak maka kembali palsu.
tatabahasa
feof(file)
参数 | 描述 |
---|---|
file | 必需。规定要检查的打开文件。 |
Tips dan Catatan
Tip: feof () fungsi untuk melintasi panjang data yang tidak diketahui berguna.
contoh
<?php
$file = fopen("test.txt", "r");
//Output a line of the file until the end is reached
while(! feof($file))
{
echo fgets($file). "<br />";
}
fclose($file);
?>
$file = fopen("test.txt", "r");
//Output a line of the file until the end is reached
while(! feof($file))
{
echo fgets($file). "<br />";
}
fclose($file);
?>
Kode di atas akan menampilkan:
Hello, this is a test file.
There are three lines here.
This is the last line.
There are three lines here.
This is the last line.
Lengkapi manual PHP Filesystem Referensi