note 2522 modified in fileperms by ronabop
| From: | ronabop@php.net | Date: | Mon, 02 Oct 2000 10:41:31 +0000 |
| Subject: | note 2522 modified in fileperms by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-5891@lists.php.net to get a copy of this message | ||
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
http://www.php.net/manual/function.fileperms.php