PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
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?
tasairis wrote:is_file() and file_exists() are important too.
No, I meant we don't know where he uses that check. For example, if you check dir for existence before attempting recursive delete, you want to distinguish between a link to a directory and directory itself (both return true for is_dir() call) and run unlink() for link and recursive delete for real directories.
tasairis wrote:is_file() and file_exists() are important too.
No, I meant we don't know where he uses that check. For example, if you check dir for existence before attempting recursive delete, you want to distinguish between a link to a directory and directory itself (both return true for is_dir() call) and run unlink() for link and recursive delete for real directories.
Okay, that's true. But I'm just looking at his existing code. That particular function can be replaced with a single call to is_dir.
tasairis wrote:is_file() and file_exists() are important too.
No, I meant we don't know where he uses that check. For example, if you check dir for existence before attempting recursive delete, you want to distinguish between a link to a directory and directory itself (both return true for is_dir() call) and run unlink() for link and recursive delete for real directories.
Okay, that's true. But I'm just looking at his existing code. That particular function can be replaced with a single call to is_dir.
Yap, works fine this way. Simple solution is almost allways the best solution