← All built-ins / is_writable()

is_writable()

is_writable(string $s): bool

Parameters

NameTypeDescription
$pathstringpath to test

Return value

true when the file exists and can be written.

Example

file_put_contents("/tmp/hphp_doc_w.txt", "x");
var_dump(is_writable("/tmp/hphp_doc_w.txt"));
unlink("/tmp/hphp_doc_w.txt");
bool(true)

See also

is_readable()file_exists()