Home > PHP > Function > Filesystem > rename()

rename()

rename - Renames a file or directory

Syntax

bool rename (string $oldname, string $newname, resource $context)

Arguments

  • oldname - Note: The old name. The wrapper used in oldname mustmatch the wrapper used in newname.
  • newname - The new name.
  • context - Note: Context support was added with PHP 5.0.0. For a description of contexts, refer to Stream Functions.

Description

Attempts to rename oldname to newname.

Version

PHP 4, 5

Return value

Returns TRUE on success or FALSE on failure.