After discussing about open, read and copying PHP files we will be discussing about rename function.
rename ():
The rename() function is used for renaming a file or directory.It takes two parameters :
1.the original filename
2.the new filename
rename() function will return true on success and false on failure.
Here is an example:
<!--?php
$filename_new = $filename . '.old';
rename($filename, $filename_new); ?-->
If you had $filename set to c:\rename\myoriginalfile.txt, the above script would move that file to c:\rename\myoriginalfile.txt.old.
NOTE:If you choose to pass an existing file of yours as the second parameter of rename(), it will rename the file of parameter one provided by you to the new file which will be in parameter two, overwriting the original file.
0 Comment(s)