DirectoryIterator::isDot

(PHP 5, PHP 7)

DirectoryIterator::isDot現在の DirectoryIterator アイテムが '.' もしくは '..' であるかどうかを調べる

説明

public DirectoryIterator::isDot ( void ) : bool

現在の DirectoryIterator アイテムがディレクトリであり、かつ . あるいは .. のどちらかであるかどうかを調べます。

パラメータ

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

返り値

エントリが . あるいは .. である場合に TRUE、そうでない場合に FALSE を返します。

例1 DirectoryIterator::isDot() の例

この例は、すべてのファイルを出力しますが ... は無視します。

<?php
$iterator 
= new DirectoryIterator(dirname(__FILE__));
foreach (
$iterator as $fileinfo) {
    if (!
$fileinfo->isDot()) {
        echo 
$fileinfo->getFilename() . "\n";
    }
}
?>

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

apple.jpg
banana.jpg
example.php
pears.jpg

参考