Accessing a file with contents

  • Thread starter Bertel Lund Hansen
  • Start date
B

Bertel Lund Hansen

Hi all

I have made some pages where PHP produces a menu and gets the
contents from separate files. It works okay. But something I read
made me wonder if there smarter ways to access the content file.

At present I use include($content). Now I realize that this means
that the conten file is PHP-parsed. I use that in some cases so I
probably won't change it.

If however I only needed to get the text and send it directly to
the browser, is it true then that just I can use

<? readfile($contents); ?>

or

<? file($contents);
some_smart_way_of_printing_an_array();
?>

Can I trust that readfile() will send the contents to the browser
without a specific print() command?

I read a note about the new version of file_get_contents() not
being very fast (since it got binarysafe). Do others agree with
this?

I did not see any particular difference in speed when I tried
readfile() instead of include(). Does it matter?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top