PHP is_executable() Function

Definition

The is_executable() function checks whether the specified file is executable.

Syntax

PHP is_executable() Function has the following syntax.

is_executable(file)

Parameter

ParameterIs RequiredDescription
fileRequired.File to check

Return

This function returns TRUE if the file is executable.

Note

The result of this function are cached. Use clearstatcache() to clear the cache.

Example

is_executable() returns true if the string parameter is executable.

For example, to check whether a file is executable:


<?PHP//  w w w.  j  av  a 2 s  . c o m
      $filename = 'c:\boot.ini'; // Windows
      $filename = '/etc/passwd'; // Unix

      if (is_executable($filename)) {
             print 'File executable!';
      } else {
             print 'File not executable!';
      }
      
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions