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
Parameter | Is Required | Description |
---|---|---|
file | Required. | 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.