In this article, you will learn how to check if the file is writeable or not in PHP. The is_writable() function in PHP checks whether the specified filename is writable.
what is the syntax of the IS_WRITABLE function in php?
IS_WRITABLE(file)
Parameter | Description |
---|---|
file | Required. Specifies the path to the file to check |
examples of the IS_WRITABLE function
Example 1. In this example, we check whether the specified filename is writable.
<?php
$file = "test.txt";
if(is_writable($file)) {
echo ("$file is writable");
} else {
echo ("$file is not writable");
}
?>