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