How to use Filesystem rename in PHP

In this article I am going to explain about rename function in PHP.
  • 1480

PHP rename() Function

The filesystem rename function renames a file or directory.

Syntax of rename function

rename(oldname, newname, context)

Parameters in rename function

It have three parameter:

Parameter Description
oldname Specifies old filename.
newname Specifies new filename.
context Specifies the context of the file handle.

Example of filesystem rename function

<html>

<body>

<?php

echo rename("add.php","sum.php");

?>

</body>

</html>


Output:

rename-php.jpg

You may also want to read these related articles :
here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.