English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

PHP fileowner() Function Usage and Example

PHP Filesystem Reference Manual

The fileowner() function can return the user ID (owner) of the specified file. This function can return the user ID on success or return false on failure.

Syntax

int fileowner ( string $filename )

The result of this function can be cached, so we can use the clearstatcache() function to clear the cache. This function cannot run on Windows systems. We can use the posix_getpwuid() function to convert the user ID to a username.

Online Example

Get the owner of the file:

<?php
   echo fileowner("sample.txt");
?>
Test and see‹/›

Output Result

0

PHP Filesystem Reference Manual