php8.5
Home/ Manual/ spl / splfileinfo/ SplFileInfo::isWritable

SplFileInfo::isWritable

PHP function Edit on GitHub ✎

(PHP 5 >= 5.1.2, PHP 7, PHP 8)

Tells if the entry is writable

Description

SplFileInfo::isWritable(): bool

Checks if the current entry is writable.

Parameters Parameters

Return Values

Returns true if writable, false otherwise;

Examples

SplFileInfo::isWritable example

php
<?php
$info = new SplFileInfo('locked.jpg');
if (!$info->isWritable()) {
    echo $info->getFilename() . ' is not writable';
}
?>

The above example will output something similar to:

output
locked.jpg is not writable

Source: reference/spl/splfileinfo/iswritable.xml · from the official PHP manual (php/doc-en)