Found 1466 Articles for PHP

fnmatch() function in PHP

karthikeya Boyini
Updated on 24-Jun-2020 08:54:03

221 Views

The fnmatch() function matches a filename or string against a specified pattern.Syntaxfnmatch(pattern, string, flags)Parameterspattern − The pattern to search.string − The string to test.flags − Any of the following values:FNM_NOESCAPE − Disable backslash escapingFNM_PATHNAME − Slash in string only matches slash in the given pattern.FNM_PERIOD − Leading period in string must be exactly matched by period in the given pattern.ReturnThe fnmatch() function returns TRUE if it is a match, else FALSE.The following is an example showing wildcard pattern.Example Live DemoOutputNot found!

flock() function in PHP

Samual Sam
Updated on 24-Jun-2020 08:54:32

773 Views

The flock() function locks or releases a file. The function returns TRUE on success and FALSE on failure.Syntaxflock(file_pointer, operation, block)Parametersfile_pointer − A file pointer for open file to lock or release.operation − Specifies the lock to use:LOCK_SH - Shared lock (reader)LOCK_EX - Exclusive lock (writer)LOCK_UN - Release a shared or exclusive lockblock − Set to 1 if the lock would blockReturnThe flock() function returns.TRUE on successFALSE on failureExampleOutputTRUE

filetype() function in PHP

karthikeya Boyini
Updated on 24-Jun-2020 08:54:54

62 Views

The filetype() function returns the file type of a file or directory. On success, the filetype() function returns one of the following values −fifochardir (directory)blocklink (symbolic link)fileunknown (this is an unknown file type)Syntaxfiletype(file_path)Parametersfile_path − The path of the file for which we want the filetype.ReturnThe filetype() function returns file type of a file or directory on success, else it returns FALSE on failure.ExampleOutputfileLet us see another example.ExampleOutputdirectory

filesize() function in PHP

Samual Sam
Updated on 24-Jun-2020 08:55:14

338 Views

The filesize() function returns the file size. It returns the file size in bytes, on success, whereas on failure, it returns FALSE.Syntaxfilesize(file_path)Parametersfile_path − The path of the file for which the size is to be determined.ReturnThe filesize() function returns the file size in bytes, on success, whereas on failure, it returns FALSE.ExampleOutput40

fileperms() function in PHP

karthikeya Boyini
Updated on 24-Jun-2020 08:55:39

64 Views

The fileperms() function returns the permissions of a file. It returns permission as a number on success, else returns FALSE on failure.Syntaxfileperms(file_path)Parametersfile_path − The path of the file to be checked.ReturnThe fileperms() function returns permission as a number on success, else returns FALSE on failure.ExampleOutput33206Let us see another example that displays permission as octal value.Example

fileowner() function in PHP

Samual Sam
Updated on 24-Jun-2020 08:55:59

72 Views

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.Syntaxfileowner(file_path)Parametersfile_path − Path of the file.ReturnThe fileowner() function returns the user ID on success or FALSE on failure.ExampleNote − This function may or may not give correct results on Windows.Output0Above, the output 0 means the file is owner by Root.

filemtime() function in PHP

karthikeya Boyini
Updated on 24-Jun-2020 08:56:18

833 Views

The filemtime() function returns the last modification time of a file. It returns the last modification time of a file as a UNIX timestamp and returns false on failure.Syntaxfilemtime ( file_path );Parametersfile_path − The path of the file for which the last modification time will be found.ReturnThe filemtime() function returns the last modification time of a file as a UNIX timestamp and returns false on failure.ExampleOutput16127342863Let us now get the last modification time of a file as a date which is in human readable form.Example Live DemoOutputLast modification time of the file: September 24 2018 07:55:51

fileinode() function in PHP

Samual Sam
Updated on 24-Jun-2020 08:56:47

81 Views

The fileinode() function returns the inode number of a file. The function returns the file’s inode number on success, whereas it returns FALSE on failure.Syntaxfileinode(file_path)Parametersfile_path − The file to be checked.ReturnThe fileinode() function returns the file’s inode number on success, whereas it returns FALSE on failure.The following is an example −Example

filegroup() function in PHP

karthikeya Boyini
Updated on 24-Jun-2020 08:44:54

46 Views

The filegroup() function returns the group ID of a file. The group ID is returned in numerical format, use posix_getgrgid() to resolve it to a group name.Syntaxfilegroup(file_path)Parametersfile_path − The path of the file.ReturnThe filegroup() function returns the group ID in numerical format. Use posix_getgrgid() to resolve it to a group name.ExampleNote - The result may vary on Windows system.OutputFile Group = guest

filectime() function in PHP

Samual Sam
Updated on 24-Jun-2020 08:45:15

74 Views

The filectime() function returns the last change time of a file. It returns the last change time of a file as a UNIX timestamp and returns false on failure.Syntaxfilectime ( file_path );Parametersfile_path − The path of the file for which the last change time will be found.ReturnThe filectime() function returns the last change time of a file as a UNIX timestamp and returns false on failure.ExampleOutput19346322544Let us now get the last change time of a file as a date which is in human readable form.Example Live DemoOutputLast change time of the file: September 23 2018 08:12:42

Advertisements