The is_executable() function checks whether the specified file is executable.
PHP is_executable() Function has the following syntax.
is_executable(file)
Parameter | Is Required | Description |
---|---|---|
file | Required. | File to check |
This function returns TRUE if the file is executable.
The result of this function are cached. Use clearstatcache() to clear the cache.
is_executable() returns true if the string parameter is executable.
For example, to check whether a file is executable:
<?PHP/*from ww w. j a va 2s. 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.