php-src/ext/spl/examples/findfile.php
Marcus Boerger 159c538bcf Major update:
- Remove all overloading hooks -> array_read/array_access must be rewritten
- Remove all basic iterators
- Remove all 'spl_' prefixing exposed to user level
- Add RecursiveIterator, RecursiveIteratorIterator
- Add DirectoryIterator, DirectoryTreeIterator
- Add some examples
2003-11-09 14:05:36 +00:00

17 lines
345 B
PHP
Executable File

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