HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

posix_eaccess

Description

The posix_eaccess of POSIX for PHP determines the accessibility of a file.

Syntax

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

Parameters

filename

The name of the file to be tested.

flags

A mask consisting of one or more of the following:

ValueConstantDescription
0POSIX_F_OKThe file exists.
1POSIX_X_OKThe file exists and has execute permissions.
2POSIX_W_OKThe file exists and has write permissions.
4POSIX_R_OKThe file exists and has read permissions.

Return

Returns true on success or false on failure.

Examples

1 · filename

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';

$return = posix_eaccess($filename);

var_export($return);
true

2 · flags · POSIX_F_OK

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';
$flags = POSIX_F_OK;

$return = posix_eaccess($filename, $flags);

var_export($return);
true

3 · flags · POSIX_X_OK

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';
$flags = POSIX_X_OK;

$return = posix_eaccess($filename, $flags);

var_export($return);
false

4 · flags · POSIX_W_OK

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';
$flags = POSIX_W_OK;

$return = posix_eaccess($filename, $flags);

var_export($return);
true

5 · flags · POSIX_R_OK

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';
$flags = POSIX_R_OK;

$return = posix_eaccess($filename, $flags);

var_export($return);
true