• PHP Video Tutorials

PHP - Function copy()



The copy() function makes a copy of the source file to the destination, and it returns true on success or false on failure.

Syntax

bool copy ( string source, string dest )

If we copy a file with no size, the copy() function can return false, but the file can be correctly copied.

Example

<?php
   echo copy("/PhpProject/sample.txt", "/PhpProject/sample1.txt");
?>

Output

1
php_function_reference.htm
Advertisements