Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
PHP Books Media Programming Book Reviews

PHP Cookbook 238

CEHT writes "Like Tony Williams said in his review on PHP and MySQL Web Development: "PHP and MySQL are probably the most pervasive add-ons to Apache web servers across the web". And I agree with him. PHP is a very powerful scripting language, so developers (not just web developers) can do almost anything with it." Read on to see how well CEHT thinks O'Reilly's PHP Cookbook helps you do that almost everything.
PHP Cookbook
author David Sklar and Adam Trachtenberg
pages 608
publisher O'Reilly
rating 9
reviewer Edmond Lau
ISBN 1565926811
summary Solutions and examples for PHP programmers.

The approach that the authors use in PHP Cookbook is great. Like most computer books, the authors usually include a summary (in sentence forms) to illustrate what the readers will expect in each chapter. Skalar and Trachtenberg take this even further by including some preliminary (code) examples to explain the general ideas behind each chapters. The examples in the book are self-contained. In most cases, I've found examples to exactly fit my needs -- this makes it one of the better reference books.

Each chapter in the book is divided into multiple sections of Problem / Solution / Discussion with a FAQ style. In each case, a simple description of a problem is followed by a PHP script as the solution. But the meat is actually in the discussions: in-depth details are included here, where the authors also include references, extended ideas, and scripts to inform the readers how much more they can do about the issue.

For example, I was going to add a simple script to my website to parse RSS/RDF files from certain news websites (CNN, Slashdot, ...), and use it as my Mozilla homepage. (Who wouldn't?) This script seems to be simple, but I may make a mistake here and there. As reference, I opened up the book to the section "Parsing XML with SAX." Then I realized the authors already had the script to parse RSS/RDF files in the discussion. Bravo!

For myself, the most useful chapters I found are: Web Basics, Forms, Database Access, and XML. There are also good examples in topics such as security, internationalization, and file processing/management. However, this book does not cover the basics of PHP. If you are a good programmer, you should be able to get away with this using the PHP Manual. A good book to learn PHP is Programming PHP, also by O'Reilly.

Although this book covers a wide range of topics, it does not cover topics like generating PDFs. I would also like to see the authors add one (maybe two) case studies in later editions. That would give the reader a more concrete example of how to combine tricks presented by this book. Other than that, at the price of $39.95 (or $61.95 CAD), this book is a great buy!

Topics

  1. Strings
  2. Numbers
  3. Dates and Times
  4. Arrays
  5. Variables
  6. Functions
  7. Classes and Objects
  8. Web Basics - available online as example chapter
  9. Forms
  10. Database Access
  11. Web Automation
  12. XML
  13. Regular Expressions
  14. Encryption and Security
  15. Graphics
  16. Internationalization and Localization
  17. Internet Services
  18. Files
  19. Directories
  20. Client-Side PHP
  21. PEAR


You can purchase the PHP Cookbook from bn.com. 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 Cookbook

Comments Filter:
  • YES!!! (Score:5, Funny)

    by SuperDuG ( 134989 ) <be@@@eclec...tk> on Monday June 09, 2003 @12:06PM (#6151129) Homepage Journal
    Please continue to make these books, I would love to "quit passing on my knowledge" to the morons around me!!

    In all seriousness I enjoy PHP because it is pretty self explanatory, and it can use plain old html inside it too. It's just nice to use a scripting language for the web that was made for webpages originally, not a language that was created for ...

    ... does anyone really know the original intent of perl? I guess that's like trying to find the oringal intent for ducK tape (and no, don't say to seal off ventilation ducts, coz that's what they'd have you believe.)?

  • by Anonymous Coward on Monday June 09, 2003 @12:07PM (#6151149)
    Topeka, KS - High school sophomore Brett Tyson was suspended today after teachers learned he may be using PHP.

    "A teacher overheard him say that he was using PHP, and as part of our Zero-Tolerance policy against drug use, he was immediately suspended. No questions asked," said Principal Clyde Thurlow. "We're not quite sure what PHP is, but we suspect it may be a derivative of PCP, or maybe a new designer drug like GHB."

    Parents are frightened by the discovery of this new menace in their children's school, and are demanding the school do something. "We heard that he found out about PHP at school on the internet. There may even be a PHP web ring operating on school grounds," said irate parent Carol Blessing. "School is supposed to be teaching our kids how to read and write. Not about dangerous drugs like PHP."

    In response to parental demands the school has reconfigured its internet WatchDog software to block access to all internet sites mentioning PHP. Officials say this should prevent any other students from falling prey like Brett Tyson did. They have also stepped up locker searches and brought in drug sniffing dogs.

    Interviews with students suggested that PHP use is wide spread around the school, but is particularly concentrated in the geeky nerd population. When contacted by BBspot.com, Brett Tyson said, "I don't know what the hell is going on dude, but this suspension gives me more time for fraggin'. Yee haw!"

    PHP is a hypertext preprocessor, which sounds very dangerous. It is believed that many users started by using Perl and moved on to the more powerful PHP. For more information on how to recognize if your child may be using PHP please visit http://www.php.net.

  • Re:YES!!! (Score:3, Funny)

    by maharg ( 182366 ) on Monday June 09, 2003 @12:14PM (#6151238) Homepage Journal
    Practical Extraction and Report Language

    OR

    Pathologically Electic Rubbish Lister
  • by rmstar ( 114746 ) on Monday June 09, 2003 @12:58PM (#6151673)
    For Web stuff I prefer Common Lisp [kippona.net]. Better performance, plus it's a language for grownups.

    rmstar

  • Re:More PHP (Score:3, Funny)

    by Smidge204 ( 605297 ) on Monday June 09, 2003 @01:16PM (#6151890) Journal
    If you want to use a string as a integer, a float, and a string all in the same line, you don't have to cast it. ... Why can't C be that smart?

    Having a pretty broad background in VisualBasic...

    *puts on asbestos suit and goggles* ...one of the major drawbacks to that is processing overhead. In VB, any variable you don't define is of type "Variant", which is 14 bytes plus the actual data. Ouch. Not to mention the work that has to be done to figure out what the data is and properly deal with it.

    And, of course, making a typo in a variable name can make debugging a real headache. Because you don't have to cast your variables, anything you type is valid, and typos don't generate errors! (You'll always find "Option Explicit" in my VB modules!)

    Having about a month's worth of self-taught PHP behind me, and actually being very comfortable and productive with it, I find that the no-cast variable system works very smoothly. It's a little wierd when it comes to arrays, but good naming conventions help there. It's nice to not have to stop and make a new variable declaration all the time - just code.

    And let's not forget the true power of no-cast variables: obfuscation! He's using it as a flag! No wait.. it's a loop counter! NO! It's an array! AAAHH!! :)
    =Smidge=
  • Re:YES!!! (Score:3, Funny)

    by Photon Ghoul ( 14932 ) on Monday June 09, 2003 @01:20PM (#6151933)
    of course Perl can do all that and it doesn't need_a_function_for_everything() to accomplish it either

    No, it just needs a module_for_everything.pm :)
  • by Tablizer ( 95088 ) on Monday June 09, 2003 @01:27PM (#6152003) Journal
    I expected somebody to come in and say, "PHP's object support is not very good and OO and GOF patterns are the savior of code management and mega-reuse and getting dates, etc. etc." But I have not seen that. What's an OO critic to do? :-)
  • by MattRog ( 527508 ) on Monday June 09, 2003 @01:47PM (#6152229)
    Because, as we all know, the cookbook approach is the best way to go [uk7.net]. :P
  • Re:More PHP (Score:3, Funny)

    by raju1kabir ( 251972 ) on Monday June 09, 2003 @08:07PM (#6156798) Homepage
    That is super silly IMO. Other scripting languages have done just fine without "hidden types". I do not like hidden types. I do not like them in the rain, not in a train, and not in my brain, Dear Sam-I-Aim.

    Types aren't hidden in PHP
    As anyone can plainly see
    They are not hidden from your code,
    They're right there from the time you load.
    With gettype() they're revealed to you,
    With *val() you can set them too.
    There's so much flexibility
    I can hardly contain my glee.
    Setting, seeing, casting types,
    PHP answers all your gripes.

Happiness is twin floppies.

Working...