PHP Solutions

8 comments | Posted: 15 February 07 in Books, by Nathan Smith

PHP Solutions I recently read PHP Solutions by David Powers, and have to say it has been one of the better ones I’ve come across in awhile – definitely one I will keep within reach. I think the best way to describe it is to use an analogy. What CSS Mastery is for CSS, PHP Solutions is for PHP. This book is full of practical PHP tips and tricks that can help you hit the ground running. It takes a learn-by-doing approach.

While this isn’t a comprehensive how-to guide covering OOP, it does approach things with a future-proofing mindset. Powers is careful to point out where things are specific to PHP 5, and gives alternatives to making them work in version 4. He also talks about what features will be prevalent in PHP 6, such as PDO becoming the more standardized way to handle database connectivity.

The first few chapters start off with the basics, showing PHP syntax and explaining how to build dynamic templates using includes. He also shows how to protect includes from being accessed independently of their accompanying pages, storing them separately from publicly accessible directories. He also shows how to build a file-upload interface for use in a basic CMS.

He then goes on to build a photo blog, complete with auto-generated thumbnails. One cool solution he uses is checking the width of an image, and then using that numerical value to set the width of a paragraph which contains explanatory text. By constraining the width, it keeps the line of text from being longer than the image is wide. He also shows how to use PHP’s date output to keep the copyright for your site on-par with the current year.

There were only a few qualms I had with some of the client-side coding conventions. In some of his <form> examples, he had the name attribute, which is deprecated in XHTML 1.0 Strict. Such details are not terribly important, but are still worth noting. He also had a few empty <td></td> (table data cells) and superfluous <p>&nbsp;</p> placeholders for controlling page layout which weren’t exactly semantic. However, for a book dealing with a server-side language, the client-side code examples were a lot better than most!

The latter part of the book gets into more advanced topics such as user management, remember sessions with cookies, and handling database security. By the time you complete this book, you will have the know-how to create a light-weight content management system that will uniquely fit your needs.

I really like that PHP Solutions takes you through the process of creating a dynamic site from start to finish, unlike many books which contain a slew of disparate examples. I would unreservedly recommend it to anyone looking to get into PHP. For another opinion, read the book review by Jonathan Snook, freelance web developer and member of the CakePHP documentation team.

Discuss This Topic

  1. 1 Rick Curran

    Hi Nathan, that sounds like an interesting book, I’m aware of David’s work but haven’t read any of his books. I’ll have to check this one out, especially in regards to future PHP6 issues. Saying that I haven’t really made much of PHP5 yet anyway!

    One slight issue in your first paragraph you’ve got “definitely one I will keep at arm’s length”, I think maybe you mean “keep within arms reach”. Taken out of context it could be taken to mean that you don’t think it’s a good book – only if someone read just the first sentence of course! I hope you don’t mind me pointing that out!

  2. 2 Deborah


    Glad you enjoyed the book! I recommend it to everyone I know who is interested in learning PHP. The coding exercises are very good with excellent explanations of what is happening in the code.

    As you mentioned, David does a wonderful job teaching PHP, covering the basics from includes, form processing, and the photo gallery with thumbnails to the more advanced topics. I really enjoyed the last chapter, Solutions to Common PHP/MySQL Problems.

    Something to note: David is active on the Friends of Ed to answer any questions you might have about the book, or issues you might have with the coding exercises in the book. I have posted questions which have been quickly responded to, often on the same day I posted the question.

  3. 3 Nathan Smith

    Rick: Whoops! Thanks for pointing that out. I am glad that you caught my meaning, even though I wrote it completely backwards. It is fixed now.

    Deborah: Yeah, I had requested this book from Friends of ED awhile ago, and finally got around to reading it. What initially caught my eye was Carolyn Wood mentioning it at Digital Web Magazine – Our Favorite Books of 2006.

  4. 4 Deborah


    I was impressed with Carolyn’s review as well; there are now several more people on Amazon who agree with her. Her review was the reason I bought the book as a Christmas present to myself!

  5. 5 Nathan Smith

    Deborah: Excellent. I am always amazed at how much impact a favorable review by a trusted source can be. A single Digital Web mention is better than a slew of anonymous reviews on Amazon from people I don’t know.

  6. 6 David Russell

    This was one of the best books I read in the past year. It has been the sole book effective in introducing me to PHP after I experienced the frustration of reading many of those “disparate” and disorganized PHP primers.

    I wholeheartedly recommend PHP Solutions to anyone looking for a launchpad into PHP.

  7. 7 Rick Curran

    Nathan: No problem! Can I throw in a recommendation of the book ‘Essential PHP Security – A guide to building Secure Web Applications’ by Chris Shiflett? It’s a great book by one of the leading PHP security guys, there’s a website that’s related to the book. This is worthy reading from a security point of view. Many books / tutorials are sloppy and don’t deal with the security implications of writing PHP so this is a great book to read through and then go “oops, I’d better go fix that”!!!

  8. 8 Shawn Grimes

    Thanks for the review Nathan. I had eyeing this book for a few weeks now and now I’m sure I’ll be picking it up very soon. It seems to be exactly the kind of PHP book I have been looking for.


Comments closed after 2 weeks.