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
    • 116
    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()

    is_dir(file)
    

    file is a required parameter you can see below example:

    <?php
    //here defina a variable of a directory
    $file = "img";
    //here call is_dir()
    if(is_dir($file))
      {
      echo ("Sucess ! $file is a directory");
      }
    else
      {
      echo ("Error ! $file is not a directory");
      }
    ?>
    

    The output will come following of above example

     Sucess!img is a directory
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: