It's been about a year and a half since I've read this, I have the first edition, but I think most of what I write is still relevant for this second one.
At the moment, very few php books come close in trying to actually present the language as a real contender for serious and professional web development. This book attempts just that.
PHP has come a long way since its inception, but the teaching material has not really caught up and the community is still pestered with bad code, architecture and practice. This book is an eye opener as it presents php for what it can be: a convenient and flexible tool that, in the right hands, can tough up and allow a programmer to get work done efficiently. It's not to say that php can do everything, but before you blame it as the root of all evil, you should definitely understand how you, the programmer, can work at improving the quality of your code. This text offers some insight into tried and true practices, usually well established in other more mature communities.
There are 3 parts:
The Objects part is a nice introduction to many goodies in the new PHP5 object model (the whole thing is php5 centric).
Some of the topics covered in the section matter more than others imo, since in your practice you'll encounter and will definitely draw some values from them. So pay particular attention to: Autoloading, Exception handling, magic methods, namespaces, reflection.
Because PHP is still a language in search for an identity, it borrows features, coding styles and development philosophy from other languages. Despite the fact that the two are fundamentally very different, Java has heavily influenced PHP's OO design and syntax. However, some of the PHP reimplementation just ended up being "simili" stuff, rather than the real thing. That is, it has the Java flavor, but doesn't actually carry any caffeine. Unfortunately, the book doesn't dig into those details and just serves the Kool-Aid as is.
Another complaint is that you are shown many tools and given a description of how they work, but there is little depth as to when to actually use them. Java and Python programmers borrowing PHP for a project might have an easier time translating this knowledge into actual practice, since their community would have likely previously exposed them to situations these tools were meant for.
If I had to pick one particular topic that I felt was missing from the Objects section, it would be an intro to the SPL. Look for it.
If you would allow me some personal and opinionated advices (be forewarned that a lot of these go against the current dogma in PHP):
- private/protected/public: it's definitely useful to understand the _idea_ behind having a public and a private programming interface, but it's a bit of a fallacy to enforce this with actual language constructs in a dynamic technology like PHP, since it doesn't actually provide much benefits to the interpreter. Who are we then "protecting" the code from exactly, the programmer? When other concepts like inheritance get involved, things get even more cumbersome, because PHP is missing some features that allow a technology like Java to get away with it all (method overloading anyone?). An alternative approach is to leave everything public and then follow the widely adopted _convention_ to prefix what is considered private with an underscore. Programmers using your API will get a hint that the $_purifiedData property was probably not meant to be directly accessed, but in case they decide to transgress that rule, they can. If you still insist on enforcing visibility though, then only use the protected and public keywords, forget private altogether.
- inheritance: learn how it works, but most importantly, learn when to avoid it and remember to strive for "Composition over Inheritance" (see Patterns section).
- interfaces: Learn about type-checking and type-hinting and use interfaces for that purpose specifically. You can declare constants within your interfaces, but I'd recommend against also declaring methods in them. It will only constrain your APIs, since PHP doesn't allow method overloading like Java would (this is one thing many PHP so-called experts are completely oblivious about when they merrily sprinkle their code with interfaces). Another route altogether would be to simply stop relying on interfaces and type-hinting and adopt 'duck-typing', an approach more natural to dynamically-typed languages such as Python, Ruby and I dare to say, PHP.
The next section of the book is on Patterns. It's not so much about PHP than it is an attempt at making a less crappy programmer out of YOU. If you're relatively new to programming and you've chosen PHP to make your first steps, please read this section of the book, for the sake of minimizing the damage you certainly will do. This is an intro to better code organization and to the world of design patterns as they can be applied to php. If you've heard of such things as Singleton, Observer, Registry, Controller, MVC and are still scratching your head, this could apply to you to.
The Practice section was a bit of a let down. If the author cares for some suggestions:
- forget CVS: there are currently a number of popular and very good open source SCMs, Git and Mercurial currently leading the pack. At the very least, teach the increasingly outdated SVN, but this book would actually gain some value if you only just mentioned the concept of revision control, without actually naming CVS.
- forget PEAR: instead have a chapter on frameworks, which nicely ties up with what the book tries to teach.