Computer >> Computer tutorials >  >> Programming >> PHP

fileowner() function in PHP


The fileowner() function returns the user ID of a file. The user ID is returned in numerical format. You need to useposix_getpwuid() to resolve it to a username.

Syntax

fileowner(file_path)

Parameters

  • file_path − Path of the file.

Return

The fileowner() function returns the user ID on success or FALSE on failure.

Example

<?php
   $file_path = 'C:/new/one.php';
   print_r(posix_getpwuid(fileowner($file_path)));
?>

Note − This function may or may not give correct results on Windows.

Output

0

Above, the output 0 means the file is owner by Root.