PHP fileperms() Function
Definition and Usage
The fileperms() function returns the permissions of the file or directory.
If successful, returns the file access permissions. If failed, returns false.
Syntax
fileperms(filename)
Parameter | Description |
---|---|
filename | Required. Specifies the file to be checked. |
Tips and Comments
Tip: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 the permission as an octal value:
<?php echo substr(sprintf("%o",fileperms("test.txt")),-4); ?>
Output:
1777