O'Reilly logo

PHP for Teens by Maneesh Sethi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Loading Files

Opening and loading files are very common programming operations, and fortunately they are not difficult.

Opening a File

Opening a file requires the use of the fopen() function, which gives you access to any file and its contents. Let’s look at its declaration:

fopen($filename, $mode)

Both parameters are strings. Obviously $filename is intuitive; however, $mode is a little bit more complex. Let’s take a look and let me explain what that parameter means.

When you open a file, you can open it for several purposes—the most common are reading and writing. You can also open a file for appending, which means that you can add information only to the end of a file. Table 14.2 shows what the PHP manual has to say about all the possible ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required