English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Filesystem Reference Manual
The rename() function can rename files or directories, and this function returns true on success and false on failure.
bool rename ( string $oldname , string $newname [, resource $context ] )
This function attempts to rename oldname to newname and move between directories if necessary. If renaming a file and a new name exists, the file can be overwritten. If renaming a directory and a new name exists, this function will issue a warning.
<?php rename("/PhpProject/sample.txt"/PhpProject/php/sample1.txt"); echo "File renaming successful!"; ?>
Output Result
File renaming successful!