note 19708 deleted from function.fileperms by aidan

From: Date: Sat, 10 Jul 2004 13:27:35 +0000
Subject: note 19708 deleted from function.fileperms by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-73001@lists.php.net to get a copy of this message
Note Submitter: luzianwild@hotmail.com ---- you can use this function to get permissions in standard unix format ("rwx rwx rwx" with "-" as placeholder for a denied permission): function get_perms($file) { $p_bin = substr(decbin(fileperms($file)), -9) ; $p_arr = explode(".", substr(chunk_split($p_bin, 1, "."), 0, 17)) ; $perms = ""; $i = 0; foreach ($p_arr as $this) { $p_char = ( $i%3==0 ? "r" : ( $i%3==1 ? "w" : "x" ) ); $perms .= ( $this=="1" ? $p_char : "-" ) . ( $i%3==2 ? " " : "" ); $i++; } return $perms; }

« previous php.notes (#73001) next »