Learn How to copy file in php. The PHP copy file example explained here copies the content of one file (aa.tx) into another file (bb.txt).
In the following example we will show you how to use of copy() function in php. The copy function in PHP is used to copy the content of one file into another file.
Syntax of Copy file in PHP
boolean copy ( string $source_file, string $target_file )
The copy function copies the content of source_file into target_file. It returns the true or false Value.
Copy file example code
$file1=fopen("aa.txt","w");//Open the file into write mode
fwrite($file1,"this is roseindia",30);
echo copy("aa.txt","bb.txt");//Copy the content of aa.txt into bb.txt
echo fread($file2,30);//Display the content of bb.txt
this is roseindia
Recommend the tutorial