umask
PHP 4, PHP 5, PHP 7, PHP 8
umask - Changes the current umask
Manual
umask(
[int|null$mask = null] ): int
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.
Parameters
- mask
-
The new umask.
Return Values
If mask is null, umask simply returns the current umask otherwise the old umask is returned.
Notes
Note:
Avoid using this function in multithreaded webservers. It is better to change the file permissions with chmod after creating the file. Using umask can lead to unexpected behavior of concurrently running scripts and the webserver itself because they all use the same umask.
Changelog
Version | Description |
8.0.0 | mask is nullable now. |