PHP is_executable() Function

Definition and Usage

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

Syntax

is_executable(file)
Parameter Description
file Required. Specifies the file to check.

Description

Returns true if the file exists and is executable.

Tips and Comments

Note:The result of this function will be cached. Please use clearstatcache() to clear the cache.

Note:is_executable() is available for Windows starting from PHP 5.0.0.

Example

<?php
$file = "setup.exe";
if(is_executable($file))
  {
  echo("$file is executable");
  }
else
  {
  echo("$file is not executable");
  }
?>

Output:

setup.exe is executable