directory exist problem on different php versions
Posted: Fri Aug 13, 2010 9:15 pm
I am using function below, and it working well on my localhost wamp server with PHP 5.3, but
it is not working on PHP 5.2. Do anybody know a reason why it is returning false even if directory exist?
it is not working on PHP 5.2. Do anybody know a reason why it is returning false even if directory exist?
Code: Select all
function DirExists( $FullPath, $Dirname ) {
$found = null;
if ( ( $directoryHandle = opendir( $FullPath ) ) == true ) {
while ( ( $file = readdir( $directoryHandle ) ) !== false ) {
// Make sure not delaing with file or parent links (., ..)
if ( is_dir( $FullPath . $file ) && ( $file == '.' || $file == '..' ) !== true ){
if ( $Dirname == $file ){
$found = 1;
} else $found = 0;
}
}
}
return $found == 1 ? true:false;
}