This function renames a file or directory.

Syntax: rename(oldname,newname,context)

The first Parameter “oldname” is Required. It Specifies the file or directory to be renamed.

The second Parameter “newname” is Required.It Specifies the new name of the file or directory.

The third Parameter “context” is Optional.It Specifies the context of the file handle. Context is a set of options that can modify the behavior of a stream.

Description:

This function returns TRUE on success, or FALSE on failure.

Example:
Code:

rename("test.txt","test1.txt");

Explanation:

The above code rename the test.txt to test1.txt.

eXTReMe Tracker