Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.

  • Apple
  • Android
  • Windows Phone
  • Android

To get the free app, enter your email address or mobile phone number.

Have one to sell? Sell on Amazon
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See all 2 images

Object-Oriented PHP: Concepts, Techniques, and Code Paperback – June 20, 2006

3.8 out of 5 stars 20 customer reviews

See all formats and editions Hide other formats and editions
New from Used from
"Please retry"
$28.85 $0.01

click to open popover

Editorial Reviews


"An interesting and challenging book . . . Lavin has focused on a highly useful area of knowledge for web developers and has done an excellent job. Recommended." -- Kickstart News, August 2006

"Lavin's approach makes this book very easy to read . . . a useful book to add to your library." -- Linux Security, June 16, 2006

From the Back Cover

It can be tough to learn the concepts of object-oriented programming with a language like C++. Fortunately, PHP's simple object model makes it an ideal language for learning about object-oriented programming.

For the uninitiated, this guide to the latest version of PHP offers a speedy introduction to object-oriented programming, including a thorough explanation of classes as well as coverage of constructors, destructors, inheritance, polymorphism, and interfaces. You’ll learn to:
• Promote code reuse by creating your own classes and using built-in classes
• Customize and improve classes through inheritance
• Simplify database access by developing MySQL database and result set classes
• Incorporate an RSS reader into your site using only four lines of code
• Use XML easily with an object-oriented approach
• Employ PHP to autogenerate documentation for your code
• Make thumbnail images on the fly
• Replace clumsy error trapping with exception handling
• Take full advantage of advanced OO features in PHP
• Incorporate AJAX into your OO PHP code

Object-Oriented PHP will show you how to maximize PHP’s features, with much less work than you might think. With Object-Oriented PHP, you can master the basics of object-oriented programming and get up to speed on PHP in one fell swoop.


Interested in the Audiobook Edition?
If you’re the author, publisher, or rights holder of this book, let ACX help you produce the audiobook.Learn more.

Product Details

  • Paperback: 216 pages
  • Publisher: No Starch Press; 1 edition (June 20, 2006)
  • Language: English
  • ISBN-10: 1593270771
  • ISBN-13: 978-1593270773
  • Product Dimensions: 7 x 0.6 x 9.2 inches
  • Shipping Weight: 14.4 ounces
  • Average Customer Review: 3.8 out of 5 stars  See all reviews (20 customer reviews)
  • Amazon Best Sellers Rank: #940,088 in Books (See Top 100 in Books)

Customer Reviews

Top Customer Reviews

By Michael Ernest on August 27, 2006
Format: Paperback
Object-Oriented PHP is really a technical brief that seems to fall short of its own ambitions. It covers PHP 5, most notably the radical switch from prior versions to a full OOP model. Lavin summarizes the reasons for the changes and reviews basic concepts of OOP. He then develops some classes for an application that draws images from a database and displays thumbnail images. In some places the PHP 4 equivalent code is provided for study. Notes on MySQL and PHP Data Objects (PDO) are also included.

It is a terse and sometimes bumpy ride. The book's conversational tone is appropriate for fellow geeks, but I found it more distracting than reassuring. There are some summary apologies, for example, that make the chapters seem like they were transcribed from tape. Rather than go back and match the introductory objectives to the text, a summary or two admits things didn't quite work out as planned. Ok, let's say there was no time to fix it. How does calling attention to it help?

Because the book is so short, the author glosses many concepts, frequently referring to web sites for technical details and tutorials. Once or twice he refers to a well-known author (e.g., Bruce Eckel) to support a complex point. Again while this is appropriate for a peer audience, it also needlessly puts the book out of reach for some readers.

It seems to me the book once had a too-ambitious outline. The back cover states you'll learn to "Incorporate AJAX into your OO PHP code." The coverage on this topic is trivial: an eight-line paragraph that names a website from which to retrieve example code, followed by indicators in subsequent to show where the AJAX reference is. The reader would be right to feel misled.

This book should be useful to the author's PHP peers, but those same readers should understand OOP well beforehand. I doubt a skeptical or demanding reader will like this book. Beginners will almost certainly get lost early and often.
Comment 49 people found this helpful. Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback.
Sorry, we failed to record your vote. Please try again
Report abuse
Format: Paperback
From the perspective of a an experienced procedural PHP programmer learning OO, having read both this book and "PHP 5 Objects, Patterns, and Practice" by Matt Zandstra, I would definately recommend the latter to this book.

Just because Zandstra's book doesn't have a cartoon on the front, doesn't make it less accessible. In fact I found it both more advanced and easier to understand at the same time. I imagine Lavin writing this book one chapter at a time, writing each successive chapter based on what he forgot in the previous. Zandstra's order of explanation on the other hand I found invaluable and thoughtful. When you're trying to make sense of a system by reading about it in a linear (book) explanation, the order in which the information is introduced and its context is very important.

Zandstra's book is also more thorough, and seems to approach implementation from an enterprise (read proper) perspective.

Lavin spends a lot of time on an example of using OO to build a system to display images in a directory. In hindsight, it turns out the design of his code is flawed in some places. Introduction material is no place to be teaching bad habits of any kind.

This book is $10 cheaper than Objects, Patterns, and Practice, but I think if you're serious about learning OO in PHP the extra $10 is worth it for a higher quality book.
Comment 15 people found this helpful. Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback.
Sorry, we failed to record your vote. Please try again
Report abuse
Format: Paperback
Object-Oriented PHP by Peter Lavin is a good book for any traditional/procedural PHP programmer who would like to know what those object-oriented PHP programmers are so excited about. If you are considering adding object-oriented PHP to your toolbox and want a step-by-step, example based guide for the beginner, this is a good book to start with. This book is also for programmers who want to switch from PHP 4 to PHP 5.

Lavin starts with an overview of object-oriented PHP and discusses several of its advantages. He then discusses the basics of object-oriented programming such as classes and inheritance and the specifics for this type of programming in PHP. Next, he teaches you how to write your first class. One of the nice things about this book is that the author starts with this simple example and, as you progress through the book, shows how to build upon, extend and reuse that simple class to do more advanced programming.

The first step is to extend this class into a directory item class that will list all the files in a directory or list just certain files as needed. Next, you will write a thumbnail class that will create thumbnail images on-the-fly that are reduce in dimensions and quality thus reducing the download time. The third class you write is a page navigation class, similar to that used by Google, that will control the number of items listed on a page and also the number of page links in the navigation. Finally, he shows you how these three classes work together and with CSS.

Next, Lavin discusses the MySQL database class and how it works with the MySQL database. He also covers inheritance and how that can be applied to simplify error handling.
Read more ›
Comment 13 people found this helpful. Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback.
Sorry, we failed to record your vote. Please try again
Report abuse
Format: Paperback
I consider myself an advanced PHP user, I have read a few other PHP books, but I'm always looking to learn something new in the field. This book definitely is for beginners. Up to chapter 9 and so far we've learned not much except how to resize an image and handle multi-page navigation. Chapter 10 (out of 16) deals for the first time with static variables and connecting to a database. There is a brief section on patterns which covers 1 (yes one) pattern, the singleton. Anyways, this book is not bad, it's well written just don't expect to learn much new if you are a seasoned PHP programmer.

I would recommend "PHP 5 Objects, Patterns And Practice", Zandstra, if you are looking for advanced coding techniques.
Comment 3 people found this helpful. Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback.
Sorry, we failed to record your vote. Please try again
Report abuse

Most Recent Customer Reviews

Pages with Related Products. See and discover other items: javascript