PHP rename() Function
Definition and Usage
The rename() function renames files or directories.
If successful, the function returns true. If failed, it returns false.
Syntax
rename(oldname,newname,context)
Parameters | Description |
---|---|
oldname | Required. Specifies the file or directory to be renamed. |
newname | Required. Specifies the new name of the file or directory. |
context | Optional. Specifies the environment of the file handle.context is a set of options for the behavior of modifiable streams. |
Tips and Notes
Note:Before PHP 4.3.3, rename() could not rename files across disk partitions on *nix-based systems.
Note:used for oldname encapsulation protocol inmustand used for newname matching.
Note:on context support was added in PHP 5.0.0.
Example
<?php rename("images","pictures"); ?>