11-17-2008, 12:17 AM
|
#1 (permalink)
|
|
The Acquainted
Join Date: May 2008
Location: Québec
Posts: 103
Thanks: 10
|
Break if no file found in directory
Good day to you,
I have a function which return an array of files.
I would need it to break if there is no file in the directory.
Here is the code :
PHP Code:
function compileList($extensions) { if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { $ext = strtolower(end(explode('.', $file))); if (in_array($ext, $extensions) AND $file != "." AND $file != "..") { $files[$file]=implode(file($file)); } } closedir($handle); } return $files; }
Thanks !
__________________
That's why we are not alone on earth... let's build !
|
|
|
|