PHP is_writeable() function

Definition and Usage

is_writeable() function determines whether the specified file is writable.

This function is is_writable() Alias of the function.

Syntax

is_writeable(file)
Parameter Description
file Required. Specifies the file to be checked.

Description

If the file exists and is writable, it will return true.file The parameter can be a directory name that allows for writable check.

Tips and Comments

Note:The result of this function will be cached. Please use clearstatcache() To clear the cache.

Example

<?php
$file = "test.txt";
if(is_writeable($file))
  {
  echo ("$file is writeable");
  }
else
  {
  echo ("$file is not writeable");
  }
?>

Output:

test.txt is writeable