I've been trying to run fopen() to open a txt file but no matter what I tried over the past hour I always get "Resource id #10" being displayed instead of the contents of the file...

Any ideas what's going on? What am I missing or doing wrong?

It's very basic code and I've coded things similar before:

$file = fopen("file.txt", "r");
echo $file;
fclose($file);

But all I get is:

Resource id #10

    Don't know what the error was about but I figured it out.

      Because $file is a file handle (a resource), not the contents of the file.

        Write a Reply...