Hi can anyone tell me how to read entire contents of a file to a variable and echo it. like $var = readallthefilecontents echo $var
thanks IM
$file=implode("",file("filename")); echo $file;
Thanks for the reply I did that, but its not showing up on the screen
$var = join( '', file($file_name) ); echo($var);
bobio, that is the same thing.
##
See what you get with this:
$open=file("filename") or die(" could not open file ");
Thanks very much to you all... It works
Sorry dear PyroX... I didn't refresh the page for a while before posting. Then I saw after posting that an answer was already there. Oooops 😉
Personnally, what I use to read an entire file is :
<? $filename = "/usr/local/quelquechose.txt"; $fp = fopen($filename, "r"); $contents = fread($fp, filesize($filename)); fclose($fp); ?>