downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

SplFileObject::fflush> <SplFileObject::current
[edit] Last updated: Fri, 25 May 2012

view this page in

SplFileObject::eof

(PHP 5 >= 5.1.0)

SplFileObject::eofファイルの終端に到達しているか調べる

説明

public bool SplFileObject::eof ( void )

ファイルの終端に到達しているか調べます。

パラメータ

この関数にはパラメータはありません。

返り値

ファイルが終端であれば TRUE、そうでなければ FALSE を返します。

例1 SplFileObject::eof() の例

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

上の例の出力は、 たとえば以下のようになります。

apple
banana
cherry
date
elderberry

参考

  • SplFileObject::valid() - ファイル終端でないかチェックする
  • feof() - ファイルポインタがファイル終端に達しているかどうか調べる



add a note add a note User Contributed Notes SplFileObject::eof
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites