What is the best way to move a file on a server using PHP?

To move a file on a server using PHP, you can use the `rename()` function. This function allows you to rename or move a file to a new location on the server. Simply provide the current file path and the new file path as arguments to the `rename()` function.

$file_to_move = 'path/to/current/file.txt';
$new_file_path = 'path/to/new/location/new_file.txt';

if(rename($file_to_move, $new_file_path)){
    echo "File moved successfully.";
} else {
    echo "Error moving file.";
}