- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
rename() function in PHP
The rename() function renames a file or directory. The function returns TRUE on success or FALSE on failure.
Syntax
rename(old_filename, new_filename, context)
Parameters
old_filename − The old name of the file or directory.
new_filename − The new name of the file or directory.
context − Specify the behaviour of the stream.
Return
The rename() function returns TRUE on success or FALSE on failure.
Example
<?php rename("one.txt","two.txt"); ?>
Output
TRUE
Let us see another example.
Example
<?php rename("D:
ew\tutorials\java.docx","D:
ew\tutorials\programming\java.docx"); ?>
Output
TRUE
Advertisements