mixed mkperms( string $perms [, bool return_as_string = false [, string $filename ] ] )Returns permissions given a string in literal format and a filename.If the file name is omitted, the permissions that the function will return are based on 000-permissions.If return_as_string is set to true, the result will be output as a 644 format string. Otherwise it will return a string converted to base-10 for chmod.

touch('myfile.txt'); // Create a file with any permissionschmod('myfile.txt', mkperms('u=rwx,g=x,o=rw')); // myfile.txt is now at -rwx--xrw-

// Make a file and give it full permissionstouch('somefile.txt');chmod('somefile.txt', 0777);echo mkperms('g-w,o-rw', true, 'somefile.txt'); // 751echo mkperms('u=rwx,g-r,o=-', true, 'somefile.txt'); // 730// This way you can apply permissions to fileschmod('somefile.txt', mkperms('u=rwx,g-r,o=-', false, 'somefile.txt')); // somefile.txt is now at -rwx-wx---?>

PS : sorry I had to put it on pastebin, or else it just made the note way too long.