English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

Usage and Example of PHP copy() Function

PHP Filesystem Reference Manual

The copy() function copies a copy of the source file to the target location. If successful, it returns true; if failed, it returns false.

Syntax

bool copy ( string source, string dest )

Copy a file from source to dest. If we copy a file without size, the copy() function can return false, but the file can be copied correctly.

Online Example

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

Output Result

1

PHP Filesystem Reference Manual