note 2522 deleted from function.fileperms by aidan
| From: | aidan@php.net | Date: | Sat, 10 Jul 2004 13:28:02 +0000 |
| Subject: | note 2522 deleted from function.fileperms by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73005@lists.php.net to get a copy of this message | ||
Note Submitter: craiger@hemna.rose.hp.com
----
It looks like fileperms() returns the decimal value of the permission bits (rwxrwxrwx) on unix-like
filesystems. Using bitwise operators it's easy to pin down which bits are set:
Determine if file is public readable or readable to users in the "users" group:
$perms=fileperms("somefile");
if (($perms & 4) || (($gid == "users") && ($perms & 32))) {
print("readable\n");
}
Party on! -Craiger