Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to removes a directory in php ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 95
    Comment on it

    Hi Reader's,
    Welcome to FindNerd, today we are going to discuss how to removes a directory in php ?

    If you want removes a directory then you should use The rmdir() function that is removes an empty directory.
    The rmdir() function returns "TRUE" on success and "FALSE" on failure.

    syntax of rmdir() function

      rmdir(dir,context);
    

    There are two main parameter in above example: 1-Dir:-This is required parameter 2-Context:- This is optional parameter

    you can see below example

    <?php
    //here define a dir variable
    $Dir_path = "img";
    //here call rmdir()
    if(!rmdir($Dir_path))
      {
      echo ("Could not remove $Dir_path");
      }
    ?>
    

    The output of the code above will be:

    Could not remove img 
    

 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: