Hudzilla.org - the homepage of Paul Hudson
Contents > Files Wish List | Report Bug | About Me ]

8.17     Summary

This is NOT the latest copy of this book; click here for the latest version.

  • Files are a great place to store information across requests, and PHP gives you lots of ways to manipulate them. Older PHP scripts are unlikely to contain easier functions such as file_get_contents() and file_put_contents(), but these are very efficient functions and you should make use of them yourself.

  • Despite their flexibility, there is only so far files can take you - no matter how short the space between your fopen() s and fclose() s, it is still possible that two scripts may try to read from the same file at the same time.

  • File permissions can often be confusing, particularly on a server that does not belong to you. In this circumstance, make use of functions like is_readable() to make sure you have the right permissions before attempting any operations.

  • Thanks to the flexibility of PHP, you can treat HTTP and FTP connections as if they were local files, reading and writing freely.





<< 8.16 Parsing a configuration file: parse_ini_file()   8.18 Exercises >>
Table of Contents
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.



My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!



Top-right shadow
 
Bottom-left shadow Bottom shadow

Comments from other readers
mouchette@mouchette.org - 06 Sep 2008

someone please help me. i use php on my website. my whole mailer interface has become scrambled. i cant figure it out. i checked all my codes and they are correct. please contact me at mouchette@mouchette.org



Add comment
Please note that by posting a comment here you are committing it to the public domain. This is important so that others can make use of your code themselves, and also so that I can incorporate helpful notes directly into the main text. Comments are limited to 2000 characters in length.

If you are reporting an error in the content, please tell me directly.

Your name/email address:
Your comment:
 
Now, in order to verify that you're a real person, please answer this simple question: what is two plus four?
The answer is:
(please write in
numbers, eg 19)


Top-right shadow
 
Bottom-left shadow Bottom shadow