JMair Posted August 20, 2009 Share Posted August 20, 2009 Can somebody show me how to check if a variable is a directory or a file? Thanks! Link to comment https://forums.phpfreaks.com/topic/171181-solved-check-if-arrayvar-is-directory-or-file/ Share on other sites More sharing options...
Daniel0 Posted August 20, 2009 Share Posted August 20, 2009 The PHP documentation team can. is_dir is_file Link to comment https://forums.phpfreaks.com/topic/171181-solved-check-if-arrayvar-is-directory-or-file/#findComment-902703 Share on other sites More sharing options...
JMair Posted August 20, 2009 Author Share Posted August 20, 2009 The PHP documentation team can. is_dir is_file Thank you for the quick reply. I was playing with that originally, but the is_dir would print out 'bool(true)' How could I stop this? Can I do something like $isDir = var_dump(is_dir('bogus_dir/abc')); if ($isDir == "1") echo "It's a Directory"."<br>"; else echo "It's some kind of file"."<br>"; Link to comment https://forums.phpfreaks.com/topic/171181-solved-check-if-arrayvar-is-directory-or-file/#findComment-902735 Share on other sites More sharing options...
Daniel0 Posted August 20, 2009 Share Posted August 20, 2009 Maybe you should check out what var_dump does Link to comment https://forums.phpfreaks.com/topic/171181-solved-check-if-arrayvar-is-directory-or-file/#findComment-902754 Share on other sites More sharing options...
JMair Posted August 20, 2009 Author Share Posted August 20, 2009 Maybe you should check out what var_dump does Thank you master Daniel0. So wise. That's exactly what I needed! Link to comment https://forums.phpfreaks.com/topic/171181-solved-check-if-arrayvar-is-directory-or-file/#findComment-902760 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.