is_executable()
is_executable() — Tells whether the filename is executable.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
Signature
is_executable(string $filename): bool
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $filename | string | Path to the file. |
Return value
Returns true if the filename exists and is executable, or false on error. On POSIX systems, a file is executable if the executable bit of the file permissions is set. For Windows, see the note below.
Example
A runnable snippet:
$file = '/home/vincent/somefile.sh'; if (is_executable($file)) { echo $file.' is executable'; } else { echo $file.' is not executable'; }
See also
All PHP 8.5 built-in functions
Reference card built from the PHP manual page is_executable() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.