ASPit - Totally ASP JSit - Totally JavaScript
Search PHPit

Use this textbox to search for articles on PHPit. Seperate keywords with a space.


Book Review: PHP5 Recipes: A Problem-Solution Approach

(Page 1 out of 2)


Welcome to this review of "PHP5 Recipes: A Problem-Solution Approach", published by Apress. Although PHP5 has been available for quite some time now, I must admit that I'm still beginner myself when it comes to PHP5's new features, so this book is exactly what I need, and I bet many others do as well. Read on to learn more about this book.

Technical Details

Title: PHP5 Recipes: A Problem-Solution Approach
Publisher: Apress
Authors: Lee Babin, Nathan A. Good, Frank M. Kormann, and Jon Stephans
Length: 629 pages (16 chapters)
ISBN: 1590595092

The Review

This book sounds really good, and I really like books that have a problem-solution approach, as it's usually very practical. Unfortunately, the title of this book is somewhat misleading. I was under the impression that it would use a problem-solution approach to discuss the new features that PHP5 offers, such as a complete new OOP model, the SPL library, PDO, and more. But this book actually takes you through almost all the features of PHP, including a lot of stuff from PHP4. For a beginner that's perfect, but a more advanced developer will quickly get bored.

Chapter one ("Overview of PHP Data Types and Concepts") gets you started with the real basics of variables and different data types. It also takes a look at the different is_* function (i.e. is_string) and shows you how to use phpinfo(). Nothing in this chapter describes anything new from PHP5, so this chapter can be skipped if you're experienced with PHP4.

Chapter two ("Overview of Classes, Objects and Interfaces") is actually one of the best chapters of the whole book, and it thoroughly discusses PHP's OOP model, including all the new OOP features of PHP5, such as abstract classes, interfaces, visibility modifiers and more. You also learn about PHP5's new ReflectionClass to inspect classes, and the author explains UML diagrams and related concepts. This chapter is a real nugget, and is highly worth reading.

After all the new information you'll get from chapter two, chapter three ("Performing Math Operations") is a real disappointment and frankly quite boring. The only thing you'll learn in this chapter is how to do (basic) math operations, like substracting, multiplying, but also logarithms, exponents and more. The author also reviews two math libraries, and gives you code for a static Math class, but there is no new PHP5 information in this chapter whatsoever.

Chapter four ("Working with Arrays") is another chapter that introduces you to a basic part of PHP: arrays. Although this chapter is an excellent reference for working with arrays, and it explains almost every array function PHP has, it doesn't introduce any new PHP functionality whatsoever, and if you've got experience working with arrays, there is no point in reading this chapter.

Chapter five ("Working with Dates and Times") goes through all the date and time functions that PHP offers. This chapter is quite basic as well, but (thankfully) it still offers some good insight and new information, even though it doesn't introduce any new PHP5 functionality. But working with dates and times is almost always a pain, and this chapter gives you some good solutions to a wide variety of problems. It also includes a sample project, whereby a PHP implementation of the JavaScript ECMA-style Date class is written.

In chapter six ("Working with Strings") you learn all about working with strings in PHP, and the string functions, like strlen() and substr(). This is quite a short chapter, and like the previous chapters, introduces you to the basics of working with strings, which is a shame because it would've been better to talk about some of the problems that come with working with strings (i.e. unable to handle UTF-8, solutions, etc). It will also show you how to build a PageReader class, which is pretty neat.

Chapter seven ("Working with Files and Directories") shows you how to work with files, which includes reading, writing, using CSV files, writing binary data, and also shows you how to work with directories, which includes getting a file listing, sorting files and more. This is the first chapter to introduce one of SPL's (Standard PHP library) features, and the author demonstrates how to use the DirectoryIterator object to list the files in a directory.

Chapter eight ("Working with Dynamic Imaging") is all about using the GD library and PHP's image functions, but you might as well read the "Image manipulation with PHP and the GD library" article series right here on PHPit, because you'll learn exactly the same things. This chapter even introduces a dynamic thumbnail class which is very similar to the online image resizer tool we built in part 2 of the article series.

Chapter nine ("Using Regular Expressions") gets you started with regular expressions, and although no new PHP5 functionality is introduced, this chapter is still a gem, because it provides a good reference to the regex syntax, and includes more than a dozen real-world examples, with the regular expression and demo code. When I first started out with regular expressions I had a hard time learning the syntax, and this chapter does a good job at explaining it all.

Next: Part Two & Final Verdict »

2 Responses to “Book Review: PHP5 Recipes: A Problem-Solution Approach”

  1. Says: Book Review: PHP5 Recipes: A Problem-Solution Approach…

  2. Ghica van Emde Boas Says:

    If you really want to read an excellent book, just about the new features of PHP 5, read “Upgrading to PHP 5″ by Adam Trachtenberg (O’Reilly).

Leave a Reply

About the author
Dennis Pallett is the main contributor to PHPit. He owns several websites, including ASPit and Chill2Music. He is currently still studying.
Article Index
  1. Introduction & Part One
  2. Part Two & Final Verdict
Bookmark Article
Download Article
Download this article as a PDF file