PHP copy()Functions
Complete PHP Filesystem Reference Manual
Definition and Usage
The copy() function copies a file.
This function returns TRUE on success, or FALSE on failure.
Syntax
copy(file,to_file)
| Parameters | Description |
|---|---|
| file | Required. Specifies the file to copy. |
| to_file | Required. Specifies the destination of the copied file. |
Tips and Notes
Note:If the target file already exists, it will be overwritten.
Example
<?php
echo copy("source.txt","target.txt");
?>
echo copy("source.txt","target.txt");
?>
The code above will output:
1
Complete PHP Filesystem Reference Manual Other Extensions