The SplFileInfo::isExecutable() function is an inbuilt function of Standard PHP Library (SPL) in PHP which is used to check if the file is executable or not.
Syntax:
bool SplFileInfo::isExecutable( void )
Parameters: This function does not accept any parameter.
Return values: This function returns true if file is a directory otherwise return false.
Below Programs illustrate the SplFileInfo::isExecutable() function in PHP:
Program 1:
| <?php   Â// PHP Program to illustrate  // Splfileinfo isExecutable function   Â$file= newSplFileInfo(dirname("gfg.txt")); $gfg= $file->isExecutable();   Â// Print result var_dump($gfg); echo"</br>";    Â$file= newSplFileInfo(__FILE__); $gfg= $file->isExecutable();   Â// Print result var_dump($gfg);   Â?>  | 
Output:
bool(true) bool(false)
Program 2:
| <?php    Â// PHP program to use array to check  // multiple files    Â$GFG= array(     "/home/rajvir/Desktop/neveropen/dummy.php",     "/home/rajvir/Desktop/gfg_code.cpp",     "/var/www/html/",     "frame.php");   Âforeach($GFGas&$file_name) {    Â    // Create new SplFile Object      $file= newSplFileInfo($file_name);    Â    $gfg= $file->isExecutable();   Â    // Print result     var_dump($gfg);     echo"</br>"; }  ?>    | 
Output:
bool(false) bool(true) bool(true) bool(false)
Reference: http://php.net/manual/en/splfileinfo.isexecutable.php


 
                                    







