• PHP Video Tutorials

PHP - Function fileowner()



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

Syntax

int fileowner ( string $filename )

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

Example

<?php
   echo fileowner("/PhpProject/sample.txt");
?>

Output

0
php_function_reference.htm
Advertisements