Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use is_dir() function in php ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 146
    Comment on it

    Hi Reader's,
    Welcome to FindNerd, today we are going to discuss how to use is_dir() function in php ?

    The is_dir() function is used for checking a specified file in a directory and returns TRUE if the directory exists.

    syntax of is_dir()

    1. is_dir(file)

    file is a required parameter you can see below example:

    1. <?php
    2. //here defina a variable of a directory
    3. $file = "img";
    4. //here call is_dir()
    5. if(is_dir($file))
    6. {
    7. echo ("Sucess ! $file is a directory");
    8. }
    9. else
    10. {
    11. echo ("Error ! $file is not a directory");
    12. }
    13. ?>

    The output will come following of above example

    1. Sucess!img is a directory

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: