1<?php
2
3$oldname = 'readme.txt';
4$newname = 'readme_v2.txt';
5
6if (rename($oldname, $newname)) {
7 $message = sprintf(
8 'The file %s was renamed to %s successfully!',
9 $oldname,
10 $newname
11 );
12} else {
13 $message = sprintf(
14 'There was an error renaming file %s',
15 $oldname
16 );
17}
18
19echo $message;
20Code language: HTML, XML (xml)