php-src/ext/spl/examples/findfile.php
2003-11-22 20:51:15 +00:00

17 lines
389 B
PHP
Executable File

<?php
class FindFile extends SearchIterator
{
protected $file;
function __construct($path, $file) {
$this->file = $file;
parent::__construct(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)));
}
function accept() {
return !strcmp($this->it->current(), $this->file);
}
}
foreach(new FindFile($argv[1], $argv[2]) as $pathname => $file) echo "$pathname\n";
?>