What are the best practices for handling file copying operations in PHP?

When handling file copying operations in PHP, it is important to check if the source file exists before attempting to copy it. Additionally, it is recommended to use the `copy()` function provided by PHP to perform the file copying operation. It is also a good practice to handle any errors that may occur during the copying process.

// Check if source file exists
$sourceFile = 'source.txt';
if (file_exists($sourceFile)) {
    // Copy the file
    $destinationFile = 'destination.txt';
    if (copy($sourceFile, $destinationFile)) {
        echo 'File copied successfully.';
    } else {
        echo 'Failed to copy file.';
    }
} else {
    echo 'Source file does not exist.';
}