ディレクトリの操作

opendirとかreaddirとかを使っていたけど。たまたまPHPマニュアルをみて
dir()
というものを見つけた(オイ

class Directory {
  string$path ;
  resource$handle ;
  string read ( void )
  void rewind ( void )
  void close ( void )
}

ということで、次のように使えるらしい。

<?php
$d = dir("/etc/php5");
echo "Handle: " . $d->handle . "\n";
echo "Path: " . $d->path . "\n";
while (false !== ($entry = $d->read())) {
   echo $entry."\n";
}
$d->close();
?> 

これは便利ですなぁ。ていうか、入門書や参考の本でこの手の記述を見たことがない。
マニュアルを細かく読まないとだめですね。