Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP copy() Function

PHP copy() Function


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual


Definition and Usage

The copy() function copies a file.

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 destination file already exists, it will be overwritten.


Example

The code above will output:

1


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual