PHP umask() Function

The umask() function changes the file permissions for files.This function sets PHP's umask to mask & 0777 and returns the old umask. However, if you call umask() without any arguments, it returns the current umask.

int umask ([ int $mask ] )

umask() sets PHP's umask to mask & 0777 and returns the old umask. When PHP is being used as a server module, the umask is restored when each request is finished.

Example -

Return Values -

umask() without arguments simply returns the current umask otherwise the old umask is returned.

ParameterDescription
maskThe new umask