Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP umask() Function

PHP umask() Function


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual


Definition and Usage

The umask() function changes file permissions.

This function sets PHP's umask to mask & 0777 and returns the old umask. However, if you call umask() with no arguments, it returns the current umask.

Syntax

umask(mask)

Parameters Description
mask Optional. Specifies the new permissions. Default is 0777.

The mask parameter consists of four digits:

  • The first digit is usually 0
  • The second digit specifies the owner's permissions
  • The third digit specifies the permissions of the owner's user group
  • The fourth digit specifies the permissions for everyone else
  • Possible values (to set multiple permissions, add the numbers below together):

    |

    PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual