SplFileObject::eof

(PHP 5 >= 5.1.0)

SplFileObject::eofReached end of file

說明

public bool SplFileObject::eof ( void )

Determine whether the end of file has been reached

參數

此函式沒有參數。

回傳值

Returns TRUE if file is at EOF, FALSE otherwise.

範例

Example #1 SplFileObject::eof() example

<?php
$file 
= new SplFileObject("fruits.txt");
while ( ! 
$file->eof()) {
    echo 
$file->fgets();
}
?>

上例的輸出類似於:

apple
banana
cherry
date
elderberry

參見

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top