"Troy May" <[EMAIL PROTECTED]> wrote:
> Hello,
> Extreme newbie here (halfway through my first book :) ).  I need to open a
> file, read the whole file into a variable, manipulate it, and then echo it
> to the screen.  I'm doing it right from my book and it's not working.
> Here's what I have now:
> <? $header = fopen("header.html","r");
> echo $header; ?>
> It writes "Resource id #1" at the top of the page.  What is that?!  :)

Check the manual:


You're echoing the result of fopen() which is an "int"--you have to make
sure that you're using the function properly ;)

> I have also tried using file().  That displays "Array" on the screen.
> am I doing wrong?

I think it's because you're echoing the result of file() which is an array.
You cannot just "echo $the_array;" Try print_r($the_array) and you'll see a
different result--though I doubt it's the one you want to see :)

Check the manual again:


Anyway, I think you're looking for something like this:


Esp. the "User Contributed Notes".


- E

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to