Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to rename php file

    • 0
    • 1
    • 1
    • 3
    • 0
    • 0
    • 0
    • 0
    • 146
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: