PHP is_executable() Function

Definition and Usage

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

Syntax

is_executable(file)
Parameter Description
file Required. Specifies the file to be checked.

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() can be used in Windows from PHP 5.0.0 version.

Example

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

Output:

setup.exe is executable