- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1466 Articles for PHP
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!
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
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
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
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
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.
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
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
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
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
To Continue Learning Please Login
Login with Google