Link to home
Start Free TrialLog in
Avatar of peter2001
peter2001

asked on

fileperms decoct gives wrong value

hi

am stuck when tring to find the chmod value of a file its giving me a strange number

this is the code am using

echo decoct(fileperms($baseDir . '/' . myfile.php') ) ;     //this is set to 644  octal is 1204
which gives me 100644

then when i try to take away the 10000 to leave 644 it gives me this 55224

heres the code i use

echo decoct(fileperms($baseDir . '/' . myfile.php')- 10000 ) ;  

any ideas why its not showing 644 when i take the 10000 away?

regards pete









Avatar of Alex
Alex
Flag of Greece image

try to read this manual maybe will help you.


http://php.oregonstate.edu/manual/en/function.fileperms.php
or try to trim the string and cut the first 3 chars.

substr(decoct(fileperms($yourfile)),-3);
ASKER CERTIFIED SOLUTION
Avatar of Alex
Alex
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of peter2001
peter2001

ASKER

thanks