The is_executable() function checks whether a file is executable. It returns TRUE if the file exists and is executable. It returns FALSE on error.
Syntax
is_executable(file_path)
Parameters
file_path − The path of the file.
Return
The is_executable() function returns TRUE if the file exists and is executable. It returns FALSE on error.
Example
<?php $check = "D:/tutorials/setup.exe"; if (is_executable($check)) echo ("Executable!"); else echo ("Not executable!"); ?>
Output
Executable!
Let us see another example.
Example
<?php $check = "D:/tutorials/java.docx"; if (is_executable($check)) echo ("Executable!"); else echo ("Not executable!"); ?>
Output
Not executable!