Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

is_writable()

Example

Verify if the given filename can be written to:

<?php
$file = “test.txt”;
if(is_writable($file)) {
  echo (“$file is writable”);
else {
  echo (“$file is not writable”);
}
?>

 The code above might produce is:

test.txt is writable

Definition and Usage

The function is_writable() determines if the given filename may be written to.

Note: This function caches its output. To clear the cache, use clearstatcache().

Syntax

is_writable(file)

Parameter Values

 

Parameter

Description

file

Essential. gives the location of the file to be checked.

Technical Details

Return Value:

If the file can be written to, then TRUE; if not, then E_WARNING

PHP Version:

4.0+