Computer >> Computer tutorials >  >> Programming >> PHP

umask() function in PHP


The umask() function changes permissions for files. It returns the current umask is it is set without arguments.

Syntax

umask(mask)

Parameters

  • mask − Set the new permission.

Return

The umask() function returns the current umask is it is set without arguments.

Example

<?php
// -rw-------
umask(0077);
// access changed: -rw-r--r--
chmod('/new/one.txt', 0644);
echo “Access changed!”;
?>

Output

Access changed!