CHMOD question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

CHMOD question

Post by alex.barylski »

I have a files permission bits as 666 (decimal)

Read/Write for Owner, Group and Other are all set...

I need to programatically detemrine if Read/Write Owner is set...

Can this be done using a bitwise operation??? If so...can you show me how???

I have tried a simple (666 & 400) == 400

But this doesn't work...

Basically I need a way programatically to take a permission bits and determine which permissions they apply too...

Anyone??? :)

Thanks
AGISB
Forum Contributor
Posts: 422
Joined: Fri Jul 09, 2004 1:23 am

Post by AGISB »

http://www.php.net/manual/en/function.fileperms.php

or use umask to set them directly
Post Reply