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

fileowner

Description

Gets file owner

Syntax

fileowner(
    string $filename
): int|false

Parameters

filename

Path to the file.

Return

Returns the user ID of the owner of the file, or false on failure. The user ID is returned in numerical format, use posix_getpwuid() to resolve it to a username.

Examples

1 · filename

<?

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

$return = fileowner($filename);

print_r($return);

?>
1234567

2 · posix_getpwuid

<?

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

$return = fileowner($filename);

$posix_getpwuid = posix_getpwuid($return);

print_r($posix_getpwuid);

?>
Array
(
    [name] => root
    [passwd] => x
    [uid] => 1234567
    [gid] => 1234567
    [gecos] =>
    [dir] => /root
    [shell] => /bin/bash
)
HomeMenu