Forgot your password?
Programming Books Media Book Reviews IT Technology

PHP 5 Recipes 121

Posted by samzenpus
from the properly-cooked dept.
jsuda writes " With all the books being published recently about PHP a new one will need to find and fill a niche to distinguish itself. PHP 5 Recipes: A Problem-Solution Approach, published by Apress, has done so, in my view. This is an intermediate-level volume exploring PHP 5 using a recipe approach where the basics of PHP 5's functionality are expressed systematically but in a small-topic by small-topic manner. Cook-book style, each topic is relatively autonomous and can be individually selected, as necessary, for information or review, similarly to how many refer to the Joy of Cooking for help on a cooking project. It's a source for instant solutions to common PHP-related problems. There are over 200 such recipes presented." Read the rest of jsuda's review.
Php 5 Recipes: A Problem-Solution Approach
author Lee Babin, Nathan Good, Frank M. Kronman, Jon Stephens
pages 646
publisher Apress
rating 8
reviewer John Suda
ISBN 1-59059-509-2
summary A problem solving approach to Php 5

Each of these recipes refers to a small element or aspect of PHP 5 and the presentations contain a brief overview of the topic, an explanation of how the code elements work, and where the code is applicable in projects. Overall, the book covers the whole range of PHP 5 functionality where each major element of PHP 5 is addressed in a recipe explaining and illuminating relevant code elements. You can easily get information about a specific PHP 5 element by going directly to the section of the book where it appears. Even better, the code snippets are designed to allow one to copy and paste them into your own applications or development easily and then to configure them as necessary. All of the code snippets are freely available for downloading at the publisher's website at

There are 16 chapters and an index covering a total of 646 pages. The chapters are organized similarly to other PHP primers, covering the basic elements of PHP - data types, operations, arrays, strings, variables, files and directories, dates and times, functions, and regular expressions. The coverage for much of these concepts is relatively mundane and unoriginal. The discussion of dynamic imaging, however, is an exception. The writing throughout, however, is solid and clear. The book emphasizes the most important elements of new PHP 5. The object-oriented programming elements especially are covered - classes, objects, protected class variables, exception handling, interfaces, and the new mysqli database extension. The authors' discussions focus on PHP 5.0.4, MySQL 4.1, and cover Linux and Windows environments.

The book is directed at PHP programmers looking to learn the elements introduced by PHP 5, and for those looking to find fast solutions to coding problems. It assumes a basic knowledge of PHP. Many of the recipes discuss object-oriented programming and these are some of the more advanced sections of the book. I can say that Chapter 2, which introduces the object-oriented concepts is one of the better explanations of the topic that I've read. The chapter covers constructors, destructors, methods and properties, class diagrams and examples of these concepts at work in code snippets. There are a number of interesting segments containing custom coding of classes as reusable templates from which to create objects.

The book is well-designed and written. The discussion is clear and logical. The code snippets are well-explained. The authors are experienced programmers and developers, and Good and Stephens have authored or co-authored a number of technical books.

A large handful of the recipes contain projects, usually appearing at the end of the overview and presentation of code snippets covering the basics of the topics. The projects usually deal with the creation of higher-end classes and objects as solutions to common coding problems. The idea here is to show PHP 5 functionality at work providing useful code sections to be dropped into your custom applications. Chapter Five concludes with a sophisticated class dealing with dates and times issues. Other chapters contain constructions of string, file, graphics, and regular expression classes.

The last five chapters deal with using the PHP code in web applications and services. This material covers cookies (including construction of a cookie class), using HTTP headers, sessions, and using query strings. Much of this material has been covered elsewhere in the many primers on PHP already published. There is a chapter on using forms and an interesting chapter on working with markup. The better chapters are on using DOM to generate markup, parsing XML, using RSS feeds, SOAP, and simple XML. The chapter on mysql is basic, except for the section on creating a wrapper class. The last chapter deals with communicating with Internet services, like POP, iMap, and FTP. Another project presented here is one creating object-oriented code dealing with a mail class.

This is a useful book to have in a programmer's library."

You can purchase Php 5 Recipes: A Problem-Solution Approach from Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
This discussion has been archived. No new comments can be posted.

PHP 5 Recipes

Comments Filter:
  • by Anonymous Coward on Wednesday December 07, 2005 @02:47PM (#14204077)
    Due to the constant vulnerability announcements and lack of RedHat legacy rpm support, we've been removing PHP from all our webservers.
  • by CyricZ (887944) on Wednesday December 07, 2005 @03:07PM (#14204215)
    PHP is popular because it's easy to jump into and fairly easy to learn, not because it's an efficient stable development platform. PHP also has a history of security problems almost as long as Microsoft.

    Indeed. A truer statement has rarely been stated.

    From an engineering standpoint, PHP is abysmal. Many people will suggest otherwise, but they are often those who lack a formal education and background in designing secure, scalable, high-reliability software systems.

    The Hardened-PHP [] project is a perfect example of what is wrong with PHP. It's not that the Hardened-PHP project itself is bad (it's a very good thing!). The problem is that the core PHP developers have not taken such basic security concerns into consideration. The fact that they have to rely on a third party to provide such integral and necessary functionality is a very bad sign.

  • by merreborn (853723) on Wednesday December 07, 2005 @03:34PM (#14204418) Journal
    I've noticed you post a very similar PHP security troll on every PHP thread.

    I have to ask -- do you also point out C++'s flaws, in the realm of buffer overflows? It is, after all, an inherently insecure language.

    Which languages do you consider secure? Java?
  • Developer's Union? (Score:3, Interesting)

    by mcrbids (148650) on Wednesday December 07, 2005 @04:00PM (#14204621) Journal
    The term "Engineer" is, in most contexts, a priviledged term. Not just anybody can be labelled an "Engineer" until they've gone through some rigor.

    Why not apply this idea to software? If there was a coalition or Union of workers, with a commonly agreed-upon set of requirements and certifications, with annual fees and a good reason to require a decent demonstration of competence? Something with real teeth, and ongoing certification requirements. Think, the Bar, only for software engineers instead of Attorneys. As with Real Estate, being a "Realtor" is a priviledged term.

    If done right, it would be AWESOME to mention on a resume, and would likely become something like the Underwriter's Laboratories - a private entity, but one that's almost required by law simply because it's a reasonable assurance of safety.

    There are a number of VENDOR certifications (EG: CCNE, RHCE, and the laughable MCSE, etc) but is there any platform-neutral, "This guy knows how to validate input and write qualifiable code" organization?
  • by Mr. Slippery (47854) <> on Wednesday December 07, 2005 @06:13PM (#14205707) Homepage
    What happens is that a developer with such background evaluates PHP, and sees that it is completely lacking with respect to security.

    In what way? Failing to check inputs before passing them on to a database or other module is an application, not a language, problem. You claim that there are "numerous security issues found in PHP" - please, describe them. I haven't found it to be any more insecure by nature than C, C++, Perl, etcetera...indeed I'd say it's easier to write reasonably secure code in PHP than in C or C++.

"The value of marriage is not that adults produce children, but that children produce adults." -- Peter De Vries