mojito Posted February 1, 2007 Share Posted February 1, 2007 inside admin directory is a folder called "hh" and a file callled admin.php both are being seen by the script below but "hh" is not being recognised as a folder with is_dir comming out as false ??? $dir="./admin/"; openFolder(); function openFolder () { clearstatcache() ; global $dir; if (is_dir($dir)) { //open catalog $open = opendir($dir); //check every file while (false !== ($file = readdir($open))) { var_dump (is_dir($file)); echo $file; } } } Link to comment https://forums.phpfreaks.com/topic/36654-is_dir-fails-to-see-folder-is-folder-not-file/ Share on other sites More sharing options...
snowrhythm Posted February 1, 2007 Share Posted February 1, 2007 you had "while (false !== ($file = readdir($open))) ..." in your code there, is "!==" valid? shouldn't it be just "!=" ? Link to comment https://forums.phpfreaks.com/topic/36654-is_dir-fails-to-see-folder-is-folder-not-file/#findComment-174746 Share on other sites More sharing options...
Jessica Posted February 1, 2007 Share Posted February 1, 2007 !== checks the type as well as the value, that's fine. Link to comment https://forums.phpfreaks.com/topic/36654-is_dir-fails-to-see-folder-is-folder-not-file/#findComment-174748 Share on other sites More sharing options...
snowrhythm Posted February 1, 2007 Share Posted February 1, 2007 sweet...learned something new today Link to comment https://forums.phpfreaks.com/topic/36654-is_dir-fails-to-see-folder-is-folder-not-file/#findComment-174754 Share on other sites More sharing options...
mojito Posted February 1, 2007 Author Share Posted February 1, 2007 seems the full directory path works more reliably, when I thought code either worked or didnt! so where I had simply $file $dir.$file gives me the correct answer. thanks and welcome any more interest. Link to comment https://forums.phpfreaks.com/topic/36654-is_dir-fails-to-see-folder-is-folder-not-file/#findComment-174756 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.