[clug] PHP fileperms()

Jamie Reid jamie at jre.id.au
Wed Jan 30 07:43:33 UTC 2019

Hi Bryan,

>From the documentation[1]: "Returns the file's permissions as a numeric
Lower bits of this mode are the same as the permissions expected by chmod(),
however on most platforms the return value will also include information on
type of file given as filename."

It's probably going to be most useful to you to format the lower four bits
this output into an octal representation -- something that looks like 0755.

An example from the documentation shows how to do this:

    echo substr(sprintf('%o', fileperms('/tmp')), -4);

There are likely more efficient/others ways to achieve the same lower in
the page
but the above seems the easiest to understand.


[1]: http://php.net/manual/en/function.fileperms.php

On Wed, Jan 30, 2019 at 6:21 PM Bryan Kilgallin via linux <
linux at lists.samba.org> wrote:

> I used this to check two test files: txt and php. The result in both
> cases was "33188". What does this number mean, in terms of file
> permissions?
> --
> members.iinet.net.au/~kilgallin/
> --
> linux mailing list
> linux at lists.samba.org
> https://lists.samba.org/mailman/listinfo/linux

More information about the linux mailing list