Menu
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 :
[code=php]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 !