Check the directory for files

Using the directory path first check if that directory exist is_dir() and the read the files using scandir() function.

/* This function check is there any new order placed */
function checkFileExist( $path  ) {
    
    if (is_dir($path)) {
       
        $contents = scandir($path);
       
        if(count($contents) > 2) {
            return $contents;
        } else {
            return false;
        }
    }
    
}

Share this Tutorial