opens a file and returns the content as a string

01 <? 
02 function file_open($filename)
03 
04     if($fp = @fopen($filename, "r"))
05     { 
06         $fp = @fopen($filename, "r"); 
07         $contents = fread($fp, filesize($filename)); 
08         fclose($fp); 
09         return $contents; 
10     }else{ 
11         return false; 
12     } 
13 
14  
15 // use like
16 $text = file_open('data/file.txt');
17  
18 ?>