returning values from function
Posted: Sat Sep 15, 2007 12:41 pm
which is the right way of returning values.
OR
Code: Select all
function ReadTemplate($file)
{
if(!empty($file) && file_exists($file))
{
$fh=fopen($file, 'r');
$file_read=fread($fh, filesize($file));
fclose($fh);
return $file_read;
}
else
{
return 'Error in reading file';
}
}OR
Code: Select all
function ReadTemplate($file)
{
if(!empty($file) && file_exists($file))
{
$fh=fopen($file, 'r');
$file_read=fread($fh, filesize($file));
fclose($fh);
$return= $file_read;
}
else
{
$return= 'Error in reading file';
}
return $return;
}