I have the following code, which gets the data from 3 text files and puts them into 3 variables. How can I refactor this to make it smaller?
$handle = fopen($template_filename, "r");
if (filesize($template_filename) > 0)
{
$email_template = fread($handle, filesize($template_filename));
}
fclose($handle);
// get the subject from a text file
$handle = fopen($subject_filename, "r");
if (filesize($subject_filename) > 0)
{
$subject_template = fread($handle, filesize($subject_filename));
}
fclose($handle);
// get the footer from a text file
$handle = fopen($footer_filename, "r");
if (filesize($footer_filename) > 0)
{
$footer_template = fread($handle, filesize($footer_filename));
}
fclose($handle);