Search Results
Gets file permissions SplFileInfo::getPerms (PHP 5 >= 5.1.2, PHP 7, PHP 8) SplFileInfo::getPerms — Gets file permissions
Jul 11, 2025 · The SplFileInfo::getPerms () function is an inbuilt function of Standard PHP Library (SPL) in PHP which is used to get the permission of the file. Syntax: int SplFileInfo::getPerms( void ) Parameters: This function does not accept any parameter. Return values: This function returns the permission of file.
In this example, we create a new instance of the SplFileInfo class, passing the path to the desired file as a parameter. We then call the getPerms method on the object to retrieve the file permissions. Finally, we echo the file permissions after converting them to an octal representation using the decoct () function.
PHP Manual The above example will output something similar to:
Return Values Returns the file permissions on success, or false on failure.
SplFileInfo::getPerms (PHP 5 >= 5.1.2) SplFileInfo::getPerms — Gets file permissions
SplFileInfo::getPerms (PHP 5 >= 5.1.2, PHP 7, PHP 8) SplFileInfo::getPerms — Gets file permissions
