Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

php
fileperms()
communitycreator

What is the fileperms() function in PHP?

Behzad Ahmad

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

The fileperms() function in PHPHypertext Preprocessor returns the permission for a file. It accepts only one parameter, which is the file name for which we check the permission.

Syntax


fileperms(filename)

Parameters

  • filename: This specifies the path of the file, whose permission we need to check.

Return value

This function returns the file permission in the form of the number. In case of any failure, it returns false.

Code

The basic PHP code to demonstrate the use of the fileperms() function is as follows:

main.php
test.txt
<?php
echo fileperms("test.txt");
?>
The fileperms() function

Explanation

Line 2: We get the permission of the file and display it in the form of numbers.

RELATED TAGS

php
fileperms()
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring