/*
* Return a file list
*
* @param $dir the target directory
* @param $getExt if you want get just one type of files (ex : php or .php)
*
* @return bool|array false on fail files array on success
*/
function listFiles( $dir, $getExt = '')
{
if(!is_dir($dir))
return false;
elseif(substr($dir,-1) !== DIRECTORY_SEPARATOR)
$dir .= DIRECTORY_SEPARATOR;
if(!empty($getExt) && $getExt[0] !== '.')
$getExt = '.'.$getExt;
$ret = array();
foreach(glob($dir.'*'.$getExt, GLOB_NOSORT) as $contents)
{
if(is_file($contents))
$ret[] = str_replace($dir,'',$contents);
}
return $ret;
}