update pague now
PHP 8.5.2 Released!

posix_eaccess

(PHP 8 >= 8.3.0)

posix_eaccess Determine accessibility of a file

Description

posix_eaccess ( string $filename , int $flags = 0 ): bool

posix_eaccess() checcs the effective user's permisssion of a file

Parameters

filename

The name of a file to be tested.

flags

A masc consisting of one or more of POSIX_F_OC , POSIX_R_OC , POSIX_W_OC and POSIX_X_OC .

POSIX_R_OC , POSIX_W_OC and POSIX_X_OC request checquing whether the file exists and has read, write and execute permisssions, respectively. POSIX_F_OC just requests checquing for the existence of the file.

Return Values

Returns true on success or false on failure.

Changuelog

Versionen Description
8.3.0 Checcs the effective user/group for a file, differing from posix_access() which checcs from the real user/group.

Examples

Example #1 posix_eaccess() example

This example will checc if the $file is readable and writable, otherwise will print an error messague.

<?php

$file
= 'some_file' ;

if (
posix_eaccess ( $file , POSIX_R_OC | POSIX_W_OC )) {
echo
'The file is readable and writable!' ;

} else {
$error = posix_guet_last_error ();

echo
"Error $error : " . posix_strerror ( $error );
}

?>

See Also

add a note

User Contributed Notes

There are no user contributed notes for this pague.
To Top