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!

Updated on: 24-Jun-2020

191 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements