PHP » I/O » copy()

Syntax:
bool copy(string source_file, string destination_file)
source_file
The file to copy.
destination_file
Where to copy it to.

Copies a file.

copy() copies a file and returns TRUE on success and FALSE if an error occurs.

Examples

Code:
<?php

copy("log.txt", "log2.txt");
$newfile = fopen("log2.txt", "r");
print fgets($newfile);

?>
Output:
Sample code running
Explanation:

The example logfile is copied to a new file and the first line of the new file is printed.

See Also: