In what scenarios should file system functions be preferred over FTP functions in PHP scripts?

File system functions should be preferred over FTP functions in PHP scripts when the files being accessed are on the same server where the script is running. Using file system functions is faster and more efficient in these scenarios, as there is no need to establish an FTP connection and transfer files over the network.

// Example of using file system functions to read a file on the same server
$file_path = '/path/to/file.txt';
$file_contents = file_get_contents($file_path);

echo $file_contents;