php8.5
Home/ Manual/ filesystem / functions/ fileowner

fileowner

PHP function Edit on GitHub ✎

(PHP 4, PHP 5, PHP 7, PHP 8)

Gets file owner

Description

fileowner(string $filename): int|false

Gets the file owner.

Parameters

filename

Path to the file.

Return Values

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

Errors/Exceptions Failure

Examples

Finding the owner of a file

php
<?php
$filename = 'index.php';
print_r(posix_getpwuid(fileowner($filename)));
?>

Notes Clearstatcache Stat

See Also

Source: reference/filesystem/functions/fileowner.xml · from the official PHP manual (php/doc-en)