is_executable() function in PHP


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

 Live Demo

<?php
   $check = "D:/tutorials/setup.exe";
   if (is_executable($check))
   echo ("Executable!");
   else
   echo ("Not executable!");
?>

Output

Executable!

Let us see another example.

Example

 Live Demo

<?php
   $check = "D:/tutorials/java.docx";
   if (is_executable($check))
   echo ("Executable!");
   else
   echo ("Not executable!");
?>

Output

Not executable!

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 24-Jun-2020

133 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements