The filesystem
As you might have already noticed, PHP comes with a lot of native functions that help you to manage arrays and strings in an easier way as compared to other languages. The filesystem is another of those areas where PHP tried to make it as easy as possible. The list of functions extends to over 80 different ones, so we will cover here just the ones that you are more likely to use.
Reading files
In our code, we define a list of books. So far, we have only three books, but you can guess that if we want to make this application useful, the list will grow way more. Storing the information inside your code is not practical at all, so we have to start thinking about externalizing it.
If we think in terms of separating the code from the data, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access