PHP » I/O » fileperms()

Syntax:
int fileperms(string filename)
filename
The name of the file.

Returns the permissions for a file.

This function returns the permissions for a file as a UNIX-style octal integer. The most significant bit in each digit holding file permissions represents read permission, the next is write, and the least significant bit is execute. See the sample code for a practical example. If the call fails, FALSE is returned.

Examples

Code:
<?php

$perms = fileperms("fileperms.php");
printf("Permissions: %o", $perms);

?>
Output:
Permissions: 100644
Explanation:

The permissions for a file are printed as an octal number. The last three digits are the permissions for owner, group, and others. 0644 means that the owner has read and write permissions, while group and others only have read permission.

See Also: