File Functions

The following functions manipulate the local filesystem in some manner:

string basename(string path)

Return the filename component of the path

int chgrp(string filename, mixed group)

Change the file group

int chmod(string filename, int mode)

Change the file mode

int chown(string filename, mixed user)

Change the file owner

void clearstatcache(void)

Clear the file stat cache

int copy(string source_file, string destination_file)

Copy a file

string dirname(string path)

Return the directory name component of the path

int fclose(int fp)

Close an open file pointer

int feof(int fp)

Test for end-of-file on a file pointer

string fgetc(int fp)

Get a character from the file pointer

string fgets(int fp, int length)

Get a line from the file pointer

string fgetss(int fp, int length)

Get a line from the file pointer and strip HTML tags

array file(string filename)

Read an entire file into an array

int file_exists(string filename)

Check whether a file exists or not

int fileatime(string filename)

Get the last access time for a file

int filectime(string filename)

Get the last inode status change for a file

int filegroup(string filename)

Return the group ID of the file

int fileinode(string filename)

Return the inode number of the file

int filemtime(string filename)

Return the time the file was last modified

int fileowner(string filename)

Return the user ID of the owner of the file

int fileperms(string filename)

Return the file permission bits of the file

int filesize(string filename) ...

Get Webmaster in a Nutshell, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.