note 70699 added to function.fileperms
| From: | ravensworld at gmx dot de | Date: | Tue, 24 Oct 2006 09:58:52 +0000 |
| Subject: | note 70699 added to function.fileperms | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119064@lists.php.net to get a copy of this message | ||
Maybe it helps for a better reading.
function FilePermsDecode( $perms ){
$oct = str_split( strrev( decoct( $perms ) ), 1 );
// 0 1 2 3 4 5 6 7
$masks = array( '---', '--x', '-w-', '-wx',
'r--', 'r-x', 'rw-', 'rwx' );
return(
sprintf( '%s %s %s',
array_key_exists( $oct[ 2 ], $masks ) ? $masks[ $oct[ 2 ] ] : '###',
array_key_exists( $oct[ 1 ], $masks ) ? $masks[ $oct[ 1 ] ] : '###',
array_key_exists( $oct[ 0 ], $masks ) ? $masks[ $oct[ 0 ] ] : '###'
)
);
}
$perms = fileperms( "$u_folder/$_curId" );
if( $perms !== false ){
printf(
'decimal: %d | octal: %o | readable: %s',
$perms, $perms, FilePermsDecode( $perms )
);
}
----
Server IP: 217.13.201.10
Probable Submitter: 217.237.5.149 (proxied: 10.1.4.3)
----
Manual Page -- http://www.php.net/manual/en/function.fileperms.php
Edit -- https://master.php.net/note/edit/70699
Del: integrated -- https://master.php.net/note/delete/70699/integrated
Del: useless -- https://master.php.net/note/delete/70699/useless
Del: bad code -- https://master.php.net/note/delete/70699/bad+code
Del: spam -- https://master.php.net/note/delete/70699/spam
Del: non-english -- https://master.php.net/note/delete/70699/non-english
Del: in docs -- https://master.php.net/note/delete/70699/in+docs
Del: other reasons-- https://master.php.net/note/delete/70699
Reject -- https://master.php.net/note/reject/70699
Search -- https://master.php.net/manage/user-notes.php