src/FilePermissionCalculator.php
public static function getStringRepresentation($mode)
    {
        $permissions = '';

        if (($mode & 0xC000) == 0xC000) {
            $permissions = 's'; // socket
        } elseif (($mode & 0xA000) == 0xA000) {
            $permissions = 'l'; // symbolic link
        } elseif (($mode & 0x8000) == 0x8000) {
            $permissions = '-'; // regular
        } elseif (($mode & 0x6000) == 0x6000) {
            $permissions = 'b'; // block special
        } elseif (($mode & 0x4000) == 0x4000) {
            $permissions = 'd'; // directory
        } elseif (($mode & 0x2000) == 0x2000) {
            $permissions = 'c'; // character special
        } elseif (($mode & 0x1000) == 0x1000) {
            $permissions = 'p'; // FIFO pipe
        } else {
            $permissions = 'u'; // unknown
        }

        // owner
        $permissions .= (($mode & 0x0100) ? 'r' : '-');
        $permissions .= (($mode & 0x0080) ? 'w' : '-');
        $permissions .= (($mode & 0x0040) ?
                    (($mode & 0x0800) ? 's' : 'x') :
                    (($mode & 0x0800) ? 'S' : '-'));

        // group
        $permissions .= (($mode & 0x0020) ? 'r' : '-');
        $permissions .= (($mode & 0x0010) ? 'w' : '-');
        $permissions .= (($mode & 0x0008) ?
                    (($mode & 0x0400) ? 's' : 'x') :
                    (($mode & 0x0400) ? 'S' : '-'));

        // world
        $permissions .= (($mode & 0x0004) ? 'r' : '-');
        $permissions .= (($mode & 0x0002) ? 'w' : '-');
        $permissions .= (($mode & 0x0001) ?
                    (($mode & 0x0200) ? 't' : 'x') :
                    (($mode & 0x0200) ? 'T' : '-'));

        return $permissions;
    }
public static function getStringRepresentation($mode)
    {
        $permissions = '';

        if (($mode & 0xC000) == 0xC000) {
            $permissions = 's'; // socket
        } elseif (($mode & 0xA000) == 0xA000) {
            $permissions = 'l'; // symbolic link
        } elseif (($mode & 0x8000) == 0x8000) {
            $permissions = '-'; // regular
        } elseif (($mode & 0x6000) == 0x6000) {
            $permissions = 'b'; // block special
        } elseif (($mode & 0x4000) == 0x4000) {
            $permissions = 'd'; // directory
        } elseif (($mode & 0x2000) == 0x2000) {
            $permissions = 'c'; // character special
        } elseif (($mode & 0x1000) == 0x1000) {
            $permissions = 'p'; // FIFO pipe
        } else {
            $permissions = 'u'; // unknown
        }

        // owner
        $permissions .= (($mode & 0x0100) ? 'r' : '-');
        $permissions .= (($mode & 0x0080) ? 'w' : '-');
        $permissions .= (($mode & 0x0040) ?
                    (($mode & 0x0800) ? 's' : 'x') :
                    (($mode & 0x0800) ? 'S' : '-'));

        // group
        $permissions .= (($mode & 0x0020) ? 'r' : '-');
        $permissions .= (($mode & 0x0010) ? 'w' : '-');
        $permissions .= (($mode & 0x0008) ?
                    (($mode & 0x0400) ? 's' : 'x') :
                    (($mode & 0x0400) ? 'S' : '-'));

        // world
        $permissions .= (($mode & 0x0004) ? 'r' : '-');
        $permissions .= (($mode & 0x0002) ? 'w' : '-');
        $permissions .= (($mode & 0x0001) ?
                    (($mode & 0x0200) ? 't' : 'x') :
                    (($mode & 0x0200) ? 'T' : '-'));

        return $permissions;
    }
public static function getStringRepresentation ( $ mode ) { $ permissions = '' ; if ( ( $ mode & 0xC000 ) == 0xC000 ) { $ permissions = 's' ; // socket } elseif ( ( $ mode & 0xA000 ) == 0xA000 ) { $ permissions = 'l' ; // symbolic link } elseif ( ( $ mode & 0x8000 ) == 0x8000 ) { $ permissions = '-' ; // regular } elseif ( ( $ mode & 0x6000 ) == 0x6000 ) { $ permissions = 'b' ; // block special } elseif ( ( $ mode & 0x4000 ) == 0x4000 ) { $ permissions = 'd' ; // directory } elseif ( ( $ mode & 0x2000 ) == 0x2000 ) { $ permissions = 'c' ; // character special } elseif ( ( $ mode & 0x1000 ) == 0x1000 ) { $ permissions = 'p' ; // FIFO pipe } else { $ permissions = 'u' ; // unknown } // owner $ permissions .= ( ( $ mode & 0x0100 ) ? 'r' : '-' ) ; $ permissions .= ( ( $ mode & 0x0080 ) ? 'w' : '-' ) ; $ permissions .= ( ( $ mode & 0x0040 ) ? ( ( $ mode & 0x0800 ) ? 's' : 'x' ) : ( ( $ mode & 0x0800 ) ? 'S' : '-' ) ) ; // group $ permissions .= ( ( $ mode & 0x0020 ) ? 'r' : '-' ) ; $ permissions .= ( ( $ mode & 0x0010 ) ? 'w' : '-' ) ; $ permissions .= ( ( $ mode & 0x0008 ) ? ( ( $ mode & 0x0400 ) ? 's' : 'x' ) : ( ( $ mode & 0x0400 ) ? 'S' : '-' ) ) ; // world $ permissions .= ( ( $ mode & 0x0004 ) ? 'r' : '-' ) ; $ permissions .= ( ( $ mode & 0x0002 ) ? 'w' : '-' ) ; $ permissions .= ( ( $ mode & 0x0001 ) ? ( ( $ mode & 0x0200 ) ? 't' : 'x' ) : ( ( $ mode & 0x0200 ) ? 'T' : '-' ) ) ; return $ permissions ; }
Gives a string representation of the permissions.

See "Example #2 Display full permissions" on http://php.net/manual/en/function.fileperms.php

@param int $mode

@return FilePermissionCalculator
Gives a string representation of the permissions .