O'Reilly logo

PHP Pocket Reference by Rasmus Lerdorf

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

File Functions

The following functions manipulate the local filesystem or data from the 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

bool diskfree(string path)

Return the number of free kilobytes in 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

array fgetcsv(int fp, int length)

Get line from file pointer and parse for CSV fields

string fgets(int fp, int length)

Get a line from the file pointer

string fgetss(int fp, int length [, string allowable_tags])

Get a line from the file pointer and strip HTML tags

array file(string filename [, int use_include_path])

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required