In PHP scripts, how can file permissions and ownership be managed to ensure consistency during file copying operations?

When copying files in PHP scripts, it's important to manage file permissions and ownership to ensure consistency across the copied files. This can be done by using functions like `chmod()` to set permissions and `chown()` to set ownership after the file has been copied.

// Copy a file
$source = 'source.txt';
$destination = 'destination.txt';
copy($source, $destination);

// Set permissions and ownership
$permissions = 0644; // Example permissions
$owner = 'www-data'; // Example owner
chown($destination, $owner);
chmod($destination, $permissions);