PHP fileperms() Function
Definition and Usage
The fileperms() function returns the permissions of a file or directory.
If successful, returns the file's access permissions. If failed, returns false.
Syntax
fileperms(filename)
Parameter | Description |
---|---|
filename | Required. Specifies the file to be checked. |
Hints and Comments
Hint:The result of this function will be cached. Please use clearstatcache() to clear the cache.
Instance
Example 1
<?php echo fileperms("test.txt"); ?>
Output:
33206
Example 2
Return permissions as an octal value:
<?php echo substr(sprintf("%o",fileperms("test.txt")),-4); ?>
Output:
1777