A Comprehensive Reference of Filesystem Functions in PHP

All these functions are used to work with files. You can use them to read or write to a file. You can also rename or delete files with ease. They are part of the PHP core and you don't have to install anything to use these functions.

  1. basename — This function is used to return the trailing name component of given path.
  2. chgrp — This function is used to change group of a given file.
  3. chmod — This function is used to change the mode or permissions of a given file.
  4. chown — This function is used to change the owner of a given file.
  5. clearstatcache — This function is used to clear file status cache.
  6. copy — This function is used to copy a file.
  7. delete — This function is a bogus entry. You should see unlink() to delete files.
  8. dirname — This function is used to return a parent directory's path.
  9. disk_free_space — This function is used to return available space on filesystem or disk partition.
  10. disk_total_space — This function is used to return the total size of a filesystem or disk partition.
  11. diskfreespace — This function is an alias of disk_free_space().
  12. fclose — This function is used to close an open file pointer.
  13. feof — This function is used to tests for end-of-file on a file pointer.
  14. fflush — This function is used to flush the output to a file.
  15. fgetc — This function is used to get a character from file pointer.
  16. fgetcsv — This function is used to get a line from file pointer and parse for CSV fields.
  17. fgets — This function is used to get a line from file pointer.
  18. fgetss — This function is used to get a line from file pointer and strip HTML tags.
  19. file_exists — This function is used to check whether a file or directory exists.
  20. file_get_contents — This function is used to read entire file into a string.
  21. file_put_contents — This function is used to write a string to a file.
  22. file — This function is used to read entire file into an array.
  23. fileatime — This function is used to get last access time of file.
  24. filectime — This function is used to get inode change time of file.
  25. filegroup — This function is used to get file group.
  26. fileinode — This function is used to get file inode.
  27. filemtime — This function is used to get file modification time.
  28. fileowner — This function is used to get file owner.
  29. fileperms — This function is used to get file permissions.
  30. filesize — This function is used to get file size.
  31. filetype — This function is used to get file type.
  32. flock — This function is used to apply a portable advisory file locking.
  33. fnmatch — This function is used to match filename against a pattern.
  34. fopen — This function is used to open file or URL.
  35. fpassthru — This function is used to output all remaining data on a file pointer.
  36. fputcsv — This function is used to format a line as CSV and write to file pointer.
  37. fputs — This function is an alias of fwrite().
  38. fread — This function is used to perform a binary-safe file read.
  39. fscanf — This function is used to parse input from a file according to a format.
  40. fseek — This function is used to seek on a file pointer.
  41. fstat — This function is used to get some information about a file using an open file pointer.
  42. ftell — This function is used to return the current position of the file read/write pointer.
  43. ftruncate — This function is used to truncate a file to a given length.
  44. fwrite — This function is used to perform a binary-safe file write.
  45. glob — This function is used to find pathnames matching a pattern.
  46. is_dir — This function is used to tell whether the filename is a directory.
  47. is_executable — This function is used to tell whether the filename is executable.
  48. is_file — This function is used to tell whether the filename is a regular file.
  49. is_link — This function is used to tell whether the filename is a symbolic link.
  50. is_readable — This function is used to tell whether a file exists and is readable.
  51. is_uploaded_file — This function is used to tell whether the file was uploaded via HTTP POST.
  52. is_writable — This function is used to tell whether the filename is writable.
  53. is_writeable — This function is an alias of is_writable().
  54. lchgrp — This function is used to change group ownership of symlink.
  55. lchown — This function is used to change user ownership of symlink.
  56. link — This function is used to create a hard link.
  57. linkinfo — This function is used to get information about a link.
  58. lstat — This function is used to give information about a file or symbolic link.
  59. mkdir — This function is used to make a directory.
  60. move_uploaded_file — This function is used to move an uploaded file to a new location.
  61. parse_ini_file — This function is used to parse a configuration file.
  62. parse_ini_string — This function is used to parse a configuration string.
  63. pathinfo — This function is used to return information about a file path.
  64. pclose — This function is used to close a process file pointer.
  65. popen — This function is used to open a process file pointer.
  66. readfile — This function is used to output the contents of a file.
  67. readlink — This function is used to return the target of a symbolic link.
  68. realpath_cache_get — This function is used to get all the realpath cache entries.
  69. realpath_cache_size — This function is used to get the realpath cache size.
  70. realpath — This function is used to return canonicalized absolute pathname.
  71. rename — This function is used to rename a file or directory.
  72. rewind — This function is used to rewind the position of a file pointer.
  73. rmdir — This function is used to remove or delete a directory.
  74. set_file_buffer — This function is used to set a buffer value for writing operation. It is an alias of stream_set_write_buffer().
  75. stat — This function is used to give information about a file.
  76. symlink — This function is used to create a symbolic link.
  77. tempnam — This function is used to create a file with unique file name.
  78. tmpfile — This function is used to create a temporary file.
  79. touch — This function is used to set access and modification time of file.
  80. umask — This function is used to change the current umask.
  81. unlink — This function is used to delete a file.

Follow Us For Updates

FacebookTwitterGoogle+
Go To Top