|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2003-10-12 19:47 UTC] wez@php.net
  [2003-10-12 19:57 UTC] notepad at codewalkers dot com
  [2003-10-12 20:38 UTC] sniper@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 15:00:01 2025 UTC | 
Description: ------------ say you have the folder "test" and inside "test" you have: - images (folder) - the_following_code.php (file) inside the "images" folder you have some sub directories. the_following_code will NEVER return true. if i use !is_dir instead, it then returns the sub directories as files instead of folders. this appears to have been an ongoing problem, perhaps overlooked or under-explained. Reproduce code: --------------- function directory($dir) { $mydir = opendir($dir); while(false !== ($file = readdir($mydir))) { if($file != "." && $file != "..") { if(is_dir($file)) echo "$file<br>\r\n"; elseif(is_dir($mydir.$file)) echo "$file<br>\r\n"; elseif(is_dir($mydir.$file.'/')) echo "$file<br>\r\n"; } } closedir($mydir); } $path = '/inetpub/wwwroot/Scripts/test/images/'; directory($path); Expected result: ---------------- i expect a list of sub dirs.. Actual result: -------------- i get nothing.