fileowner
Description
The fileowner of Filesystem for PHP 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 )
Links
Related
Filesystem
- basename
- chgrp
- chmod
- chown
- clearstatcache
- copy
- dirname
- disk_free_space
- disk_total_space
- diskfreespace
- fclose
- feof
- fflush
- fgetc
- fgetcsv
- fgets
- file
- file_exists
- file_get_contents
- file_put_contents
- fileatime
- filectime
- filegroup
- fileinode
- filemtime
- fileperms
- filesize
- filetype
- flock
- fnmatch
- fopen
- fpassthru
- fputcsv
- fputs
- fread
- fscanf
- fseek
- fstat
- ftell
- ftruncate
- fwrite
- glob
- is_dir
- is_executable
- is_file
- is_link
- is_readable
- is_uploaded_file
- is_writable
- is_writeable
- lchgrp
- lchown
- link
- linkinfo
- lstat
- mkdir
- move_uploaded_file
- pathinfo
- pclose
- popen
- readfile
- readlink
- realpath
- realpath_cache_get
- realpath_cache_size
- rename
- rewind
- rmdir
- set_file_buffer
- stat
- symlink
- tempnam
- tmpfile
- touch
- umask
- unlink