A file can be renamed with the rename() function
Its syntax is: bool rename (string oldname, string newname)
<?
$data_file = "data.txt";
rename($data_file, $data_file.'.old') or die("Could not rename $data_file");
?>
Related examples in the same category