PHP is_executable() Function
In this chapter you will learn:
- Definition for PHP is_executable() Function
- Syntax for PHP is_executable() Function
- Parameter for PHP is_executable() Function
- Return for PHP is_executable() Function
- Note on PHP is_executable() Function
- Example - checks whether the specified file is executable
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// jav a2 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.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP is_file() Function
- Syntax for PHP is_file() Function
- Parameter for PHP is_file() Function
- Return for PHP is_file() Function
- Note for PHP is_file() Function
- Example - returns true if the string parameter is a file
Home » PHP Tutorial » PHP File Functions