PHP Cookbook (Cookbooks (O'Reilly)) and over one million other books are available for Amazon Kindle. Learn more

Vous voulez voir cette page en français ? Cliquez ici.

Sign in to turn on 1-Click ordering.
More Buying Choices
Have one to sell? Sell yours here
Start reading PHP Cookbook (Cookbooks (O'Reilly)) on your Kindle in under a minute.

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

PHP Cookbook [Paperback]

Adam Trachtenberg , David Sklar
4.3 out of 5 stars  See all reviews (3 customer reviews)
List Price: CDN$ 58.99
Price: CDN$ 29.78 & FREE Shipping. Details
You Save: CDN$ 29.21 (50%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
Usually ships within 2 to 4 weeks.
Ships from and sold by Gift-wrap available.


Amazon Price New from Used from
Kindle Edition CDN $21.64  
Paperback CDN $29.78  
There is a newer edition of this item:
PHP Cookbook PHP Cookbook
CDN$ 32.92
Available for Pre-order

Book Description

Sept. 4 2006 0596101015 978-0596101015 Second Edition

When it comes to creating dynamic web sites, the open source PHP language is red-hot property: used on more than 20 million web sites today, PHP is now more popular than Microsoft's ASP.NET technology. With our Cookbook's unique format, you can learn how to build dynamic web applications that work on any web browser. This revised new edition makes it easy to find specific solutions for programming challenges.

PHP Cookbook has a wealth of solutions for problems that you'll face regularly. With topics that range from beginner questions to advanced web programming techniques, this guide contains practical examples -- or "recipes" -- for anyone who uses this scripting language to generate dynamic web content. Updated for PHP 5, this book provides solutions that explain how to use the new language features in detail, including the vastly improved object-oriented capabilities and the new PDO data access extension. New sections on classes and objects are included, along with new material on processing XML, building web services with PHP, and working with SOAP/REST architectures. With each recipe, the authors include a discussion that explains the logic and concepts underlying the solution.

Frequently Bought Together

Customers buy this book with JavaScript: The Definitive Guide: Activate Your Web Pages CDN$ 32.92

PHP Cookbook + JavaScript: The Definitive Guide: Activate Your Web Pages
Price For Both: CDN$ 62.70

One of these items ships sooner than the other. Show details

Customers Who Bought This Item Also Bought

Product Details

Product Description

About the Author

Adam Trachtenberg is the Director of Platform and Services for eBay and is the author of two O'Reilly books, Upgrading to PHP 5 and PHP Cookbook.

Adam has an MBA from Columbia Business School. While there, he focused on general management and operations, with an emphasis on the field of technology. Adam also has a BA from Columbia University. As an undergraduate he majored in mathematics, and his other studies included computer science and Chinese.

Before returning to school, he cofounded and served as vice president for development at two companies, Student.Com and TVGrid.Com. At both firms, he led the front- and middle-end web site design and development, worked on corporate planning and strategy, and served as liaison between the product and marketing teams.

David Sklar is an independent consultant specializing in software development, strategic planning, and technical training. He was a co-founder and the Chief Technology Officer of Student.Com and TVGrid.Com. At both companies, David oversaw the architecture and development of varied systems to deliver personalized dynamic content to users around the world.

After discovering PHP as a solution to his web programming needs in 1996, he created the PX (, which enables PHP users to exchange programs. Since then, he has continued to rely on PHP for personal and professional projects. He is the author of O'Reilly's Learning PHP 5, Essential PHP Tools (Apress) and the coauthor of PHP Cookbook (O'Reilly).

When away from the computer, David eats mini-donuts, plays records, and likes to cook. He lives in New York City and has a degree in Computer Science from Yale University.

Inside This Book (Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index | Back Cover
Search inside this book:

What Other Items Do Customers Buy After Viewing This Item?

Customer Reviews

3 star
2 star
1 star
4.3 out of 5 stars
4.3 out of 5 stars
Most helpful customer reviews
1 of 1 people found the following review helpful
5.0 out of 5 stars Best PHP book ever ! March 16 2010
Fantastic book for advanced users, even for beginners. Lots of realistic examples. Became my new very well detailed PHP reference book. I love it. !00% recommended !
Was this review helpful to you?
1 of 1 people found the following review helpful
4.0 out of 5 stars Great reference book Dec 26 2009
This is an excellent reference manual for PHP. I've meddled with PHP a bit in the past, but now after going through the book, I feel a lot more confident about my ability to use PHP and know that if I'm stuck there will likely be a recipe in the book that will help me out. The book, like all the O'Reilly cookbooks, is organized into problems and solutions, which are clustered into topic chapter, such as Web Basics, Database Access, et cetera. I read it front to back because from past experience I've found that doing this lets me stumble across new information I wouldn't have, and this book was no exception.

The book had well thought out examples and often showed multiple ways to solve the same problem (and commentary on the pros/cons of the various approaches). I bookmarked a dozen or more pages with recipes I want to try out to improve aspects of my website.
Was this review helpful to you?
4.0 out of 5 stars Many useful code and examples Dec 28 2011
By drom99 TOP 500 REVIEWER
Format:Paperback|Verified Purchase
Contains many useful code and examples that can easily be integrated to any web page. The explanations are decent and the examples show how each code works ... which helps in the understanding.
Was this review helpful to you?
Most Helpful Customer Reviews on (beta) 4.4 out of 5 stars  31 reviews
34 of 34 people found the following review helpful
5.0 out of 5 stars A reference every PHP programmer should have Jan. 3 2007
By Jason - Published on
This is my first O'Reilly book in the "Cookbook" series. At first I thought this book would probably contain the code and instructions for building a couple of web applications such as a shopping cart or a blog engine. This isn't that book. Rather it provides the reader with code snippets that can be used as building blocks for all kinds of applications. If I had to describe this book in one sentence I would say it is as if the author took down all the "Hmm..., I wonder how that is done?" questions and created an answer key.

One thing I like about this book is that the authors don't waste the first few chapters trying to teach or give an overview of the language. Instead they hop right into the usage of the language that relates to real world stuff.

So here is a brief overview. The book covers PHP 5 and goes over many of the new and improved features. The first six chapters provide recipes for more basic subjects (strings, numbers, dates & times, arrays, variables, and functions. Again, this isn't an intro to PHP, that is another book such as Programming PHP from O'Reilly. This is that book you reach for once you have moved from PHP basics and are ready to build some real world stuff.

By chapter seven the authors are discussing classes and objects. I like using classes when coding in C++, so this is a good chapter for those who like OOP. The next nine chapters go over web stuff starting out with basic things like cookies, forms, and databases. Then the authors go into more advanced areas like session management, XML, automation and web services (REST, SOAP, Mail, FTP, LDAP, and DNS to name a few).

The next chapter [17] is on the topic of graphics. This is a cool chapter if you like to create dynamic images. Things like creating a button image on the fly, or generating charts. Graphics are great to have a knowledge of because everyone likes graphical presentation of data and this chapter can help you get there.

Chapter 18 is on security and encryption which I found rather helpful. No one wants there web application to be the link that allows data to be compromised, and this chapter deals with many of those problem areas. Chapter 19 covers localization, chapter 20 is on debugging and testing. The debugging section does a great job of getting a person setup with the tools they need to properly debug an application including creating your own exception class. This is an outstanding chapter that every programmer can appreciate since every application needs debugging.

The remaining chapters cover performance tuning, regular expressions, files, directories, command line PHP, PERL and PECL. Being a Perl guy I found it interesting to see how the authors utilized regular expressions in PHP. And the chapter on command-line PHP was outstanding; I thought the recipe for creating a PHP command shell was pretty cool.



This book is like having the answer key to most of the random questions a person comes up with when writing code. I found this book to be very useful, it will be one of those references that I keep close, and gets very little shelf time. It is a solid book. It is hard to say what parts I liked best because this is one of those books that you like and must have, but then as time goes on and you use it more and more its value grows. This is an excellent book and I would strongly recommend it the PHP users that want to move to the next level.
5 of 5 people found the following review helpful
3.0 out of 5 stars Hit AND Miss March 26 2010
By Darkness' Ally - Published on
I've owned this book for about 2 years, my PhP coding experience being intermediate both before AND after reading it. It is by no means a lesson book, as implied by another person's review, but instead follows the term "cookbook" very well. A quick explanation of my review's title: "Hit AND Miss". It's mostly "hit" but there are a few aspects that left me feeling as though I was lacking in level of knowledge, something also expressed in another person's review, concerning the book's contents.

For one, for up to intermediate small issues it definitely hits the mark. The code snippets are (mostly) well-commented or explained in the surrounding paragraphs, as well as (from what I can tell) easy on server load. Some are (of course) more processor-intense than others, but that's the nature of any programming/scripting language: some stuff's simple and quick and other stuff is just downright tedious to type-out and (possibly) can become a thorn in the Server's side (forgive my pun).

The book's Problem-into-Solution format is very easy to follow, almost identical to a Q&A format. The table of contents in the book alone is far more extensive than I would ever expect from a book of this size, and it is definitely a wealth of knowledge, technique and guidelines up to a certain point.

If I had to pick one thing to complain about it would have to be some of the solutions themselves. My other complaints are nothing compared to this one. The following is based on my own personal preference and server settings/extensions, so if you have PEAR and like using it (most people do, it seems), then disregard the following.

A bunch of solutions are explained using PEAR. It's been so long since I've read up on PEAR that I've no clue of what it stands for or even if you have to install it a certain way. Be that as it may, I choose not to use frameworks of any kind most of the time. PEAR is at the top of my "do not use" list. I've seen what it can do, and I think it's great, but I want to get my hands dirty, and PEAR can really take that away. Back to it: the PEAR-based solutions more often than not come with no alternative solution. There is one I remember concerning pagination where it gives the pure-PEAR way and an alternative. However the alternative involves other PEAR extensions. The alternative is an alternative to only PEAR's "DB_Pager" class, and not a full alternative. One would need to know what the PEAR was doing (have PEAR) and alter the code to keep it PEAR-free if one were in my shoes. I've since been able to adapt it, it wasn't hard. But there are beginners out there who have poor skills at transposing (correct word?) code from classes or frameworks into something completely customized. When I started out it was the OREILLY PHP Cookbook and the OREILLY Learning PHP & MySQL books I started with, along with some guitar books for learning Christmas songs (I know, unrelated, same box though :P).

All-in-all the book is worth the price. The pros outweigh the cons almost 3 to 1. I still use this book to refresh my memory of techniques long since forgotten or fuzzy, even 2 years after I've purchased more advanced books that cover most of the same things in greater detail and moulded for greater scale. PHP as many know is very unforgiving when it comes to screw-ups, and the little things that you forget can make or break a script. I'll be keeping this book for years and years to come to dust off and refresh my memory. My website is still lacking, but heck, it's a personal website, and wouldn't be nearly as good (??? :P) as it is now without the "cookbook".
5 of 5 people found the following review helpful
4.0 out of 5 stars Must have for all PHP developers. May 14 2007
By Steven Lee Osborn - Published on
I find most technical books impossible to read from front to back. I typically just use them as reference books. Unfortuanately most techbooks aren't organized with this in mind. That's why I love the cookbook series. They tend to contain far more example code then typical programming books and are ideal reference books. The PHP Cookbook is an excellent resouce for PHP novices and experts alike. PHP Cookbook (2nd Edition) is exactly what you would expect from a O'Reilly's cookbook. Everyone reguardless of skill level will feel they hit the jackpot with this book because it has tons of sample code and examples that explain how to do just about anything imaginable in PHP.

The chapters are organized according to topic and each subsection is basicly a short how-to comprised of a problem, solution and disscussion section that explains the solution in detail. Topics include XML, form handling, database interaction, session management and a lot more. I find all O'Reilly's cookbooks to be extremely useful and PHP Cookbook is ceartainly the most useful PHP book I own.
10 of 12 people found the following review helpful
4.0 out of 5 stars PEAR DB Dec 6 2006
By A. D. Searle - Published on
This is basically an excellent book. A lot of very useful stuff. Unlike the online PHP manual, it is on this technology called a book. This comes in handy on say a NYC subway train, where you want to brush up on some PHP, or find the solution for something you are working on.

One major warning though: all the database stuff (about 20-30 percent of the book) depends on the PEAR DB class. That is a great thing to use as are many of the PEAR classes. But there is certainly great PHP code that doesn't rely on PEAR DB.

Besides the db stuff the book has great examples with strings, numbers, I/O (files and directories), dates, etc. And being that I used to be a Reptile Biologist - you got to love that Iguana. If nothing else, just buy it for the cover.
4 of 4 people found the following review helpful
5.0 out of 5 stars Dog-eared, tattered & torn Feb. 9 2009
By d - Published on
Format:Paperback|Verified Purchase
I bought about 25-30 PHP/MySQL books while learning & this was easily one of my top 5 most used. Programming PHP (Oreilly) and PHP 5 in Practice (Developer's Library) are also pretty solid. If you're ready for MySQL, replace the latter with PHP and MySQL Web Development (4th Edition, Developer's Library). I also found the Apress books fairly helpful. Definitely get the Cookbook, though. You'll reference it whenever you code.
Search Customer Reviews
Only search this product's reviews

Look for similar items by category