Actions

 Language:
 RSS flow:


PHP - Files informations


Overview

PHP language has a lot of functions to make some tests on files, and retreive several informations.

Those functions include:

  • is_dir()
    Lets you know if the file whose name is passed as parameter is a directory. This function returns 1 if it is a directory, otherwise, it returns 0.
    Example:
       if (is_dir($file)) {
         echo "The file ".$file." is a directory";
       } else {
         echo "Le file ".$file." is not a directory";
       }

  • is_executable()
    Lets you know if the file whose name is passed as parameter is executable. This function returns 1 if the file is executable, otherwise it will return 0.

  • is_file()
    Lets you know if the file whose name is passed as a parameter does not correspond either to a directory or a symbolic link, and it exists on the server's hard drive.
    This function returns 1 if it is a file, and it is present on the disc, otherwise it will return 0.

  • is_link()
    Lets you know if the file whose name is passed as a parameter corresponding to a symbolic link.
    This function returns 1 if it is a symlink, otherwise it will return 0.

     

    Go back