Slashdot Mirror


Core PHP Programming

honestpuck writes "One of my key concerns when reviewing a good book is the pull between information density and a light, easily read style. I believe that as we get further along the learning curve we can sacrifice some readability for density -- we want more facts and less explanation." Read on for honestpuck's take on the third edition of Core PHP Programming to see how well it achieves that balance. Core PHP Programming (3rd Edition) author Leon Atkinson with Zeev Juraski pages 1041 publisher Prentice Hall PTR rating 9 reviewer Tony Williams ISBN 0130463469 summary Good comprehensive guide for beginner to expert

The authors of Core PHP Programming have found a marvelous middle ground. Toward the beginning of the book they have a great deal of light, explanatory material as they cover the basics of PHP. As they move towards more advanced topics there is less explanation and a tighter packing of information. At the same time the book has a large number of small code examples throughout, making sure that you know how to use the functions under discussion.

This is the third edition and I must admit that I had not come across it in either the first or second editions, so I have no great way of comparing them in this review. It has certainly been revised to take into account the changes for PHP 5 and examining the table of contents for the second edition on Safari I can see the that the basic structure has remained the same while the book has grown about 300 pages. The addition of Zeev Suraski as co-author can only be to the benefit of the quality of the information, particularly regarding PHP 5.

The book starts with the absolute rock bottom of PHP, the basic data types and operators through to efficiency, debugging and design patterns. Along the way it covers almost all aspects of PHP 5 with a readable reference style. The 'Core' in the title of this book is a key to understanding it. If you're looking for a book with all the code required to handle session management, or user logins and security (to mention two possibilities) then this isn't the book for you. If, however, you are after a book that more than adequately explains the power and nuances of PHP and programming in the language then this is a marvelous volume.

It's broken up into 5 sections: "Programming PHP," which covers the basics of data, control flow and I/O; "Functional Reference," which is 600 odd pages broken up into 12 chapters that seems to cover every PHP function (a check of three sub chapters showed every function mentioned on the topic at PHP.net was also in the book) and does it well with good explanation and code examples; "Algorithms," which details a number of methods of performing routine tasks such as sorting, parsing and generating graphics; and "Software Engineering," devoted to design, efficiency and design patterns; and finally, there are a seven excellent appendices.

Taken as a whole it does a good job of covering the whole language and the ways of using it.

I can imagine it would make a good companion volume to my other favourite PHP volume, PHP and MySQL Web Development, which tends more towards recipes and leaves out the encyclopedic coverage of this book.

Leon Atkinson has a good page for the book that includes a link to download all the code and examples, a link to the Prentice Hall page for those wanting an example chapter or a look at the Table of Contents and some other reviews. His site also has a page for the inevitable errata, currently blank. While I did find only one typo (not in example code) I can't claim to have read every page or run all the code examples.

I'd recommend this volume to anyone who wanted a comprehensive guide to PHP 5. It is probably useful at almost all levels.

You can purchase Core PHP Programming, 3rd Ed. from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

21 of 223 comments (clear)

  1. Re:Needed? by kev0153 · · Score: 5, Funny

    Dang you beat me to the obligatory "Online Documentation is good enough" quote that always comes up with these php book reviews. I needed some karma today.

  2. Re:Needed? (Obligatory reply) by October_30th · · Score: 5, Insightful
    Online documentation is also ugly and hard to read.

    I always print out the manuals, faqs and howtos I read frequently. I also print out important e-mails.

    --
    The owls are not what they seem
  3. Re:Needed? by pogle · · Score: 4, Interesting

    Indeed. When I was first learning PHP and doing a lot of local testing, I just downloaded the whole doc to my PDA. Easy searching, and remembers my place even if I close the cover ;)

    I will admit I've got 2 O'Reilly books on PHP (Programming and the Cookbook) but more often than not its easier to just hop on their site and search there. The books are there to look cool with the rest of my O'Reilly collection.

    Personally I like the user comments in the online docs the best. Half the time someone's already written some small function that I'm looking for, or quite adequately explained all the various cases of some esoteric function return.

    --
    http://thechubbyferret.net - Ferret pictures and informative links.
  4. Incomplete PHP5 by TekZen · · Score: 4, Insightful

    I was very excited to get a book that covers PHP5. However, since PHP5 is still changing the book leaves a lot to be desired. There is no information at all on SimpleXML, which will probably be the prefered XML handler once PHP5 is released. When I bought the book I was expecting it to be one of those books that gets worn out from use. However, I haven't touched it in over a month (and I probably bought it 6 weeks ago). I would wait to buy books on PHP5 until PHP5 is out. -Jackson

  5. PHP books *are* needed, just not all of them by mgkimsal2 · · Score: 4, Insightful

    There's a lot of people who say 'you don't need a book, the online docs are great!'. I disagree.

    *Some* books are good (although I think there are too many which repeat the same information, not enough focus on particular topics in the PHP world) and necessary because they can go into greater detail than you get from the online docs.

    "What about online tutorials?" Some are good, but having it all in one book, written by only one or two authors (as opposed to wrox-style 15 authors) can help keep a consistent presentation of concepts from beginning to end.

    I'm not saying online sucks and all books are great - many PHP books aren't all much more useful than the online docs really. But for those that try to actually teach, rather than reprocess, I think they can be more valuable over time than *just* the online docs.

    Personally, I think this 3rd edition is good, although there is, imo, too much reprocessing of the manual. You could cut 200-300 pages out of this book and not miss much of anything. What would be left is worthwhile, though. What's missing in all the reference material is details on what, if any, differences there are between PHP4 and PHP5. If it's there it's in text form, not a standard icon set to alert you of potential differences.

    BTW, I have roughly the same arguments for PHP training courses, which we teach (subtle plug). "It's all online!" isn't the best answer for everyone. Many people struggle for hours or days with some concepts with only tutorials and reference pages. Put them in a classroom where they can get immediate feedback on new concepts, and they get it much quicker. Each person learns and adapts to new information in different ways, and classroom training is appropriate for some people, whether it's "only" PHP or something else.

    1. Re:PHP books *are* needed, just not all of them by mgkimsal2 · · Score: 4, Informative

      The developer cookbook, because of the 'recipe' approach (identify problem, discuss it, show solution).

      There's an older NewRiders book by, argh, lost the name - blue/purplish spine, something like "Web Application Development with PHP". One of the first books I saw on PHP where they went into advanced concepts, and didn't treat the reader as if they knew no programming. You were walked through various business problems and shown how they were addressed, and IIRC chapters built on earlier chapters for continuity.

      Some WROX are OK, but it's hit and miss.

      Haven't read the new Schlossnagle book yet, but it looks good too (likely more internal, gutsy type stuff not just 'here's a variable' kind of thing).

      HTH

  6. Namespaces by Anonymous Coward · · Score: 3, Informative

    I've had this book for awhile, and I do agree that it is on the whole a nice book -- being in its third reprint one has to expect that. However, the book doesn't really cover PHP 5 at all. None of the new extensions such as simplexml, sqlite are discussed (just the Zend Engine 2 stuff). On top of that, the ZE2 stuff is even outdated as it talks about things like Namespaces which were removed from PHP 5.

  7. Re:Needed? by RetroGeek · · Score: 5, Insightful

    Does one really need a 1000 page reference on PHP? The online documentation is free, downloadable, and quite complete.

    The online docs do not say HOW to program in PHP.

    Yes, they are a great reference, and actually are the best online docs I have seen (mostly due to the comments), but you still need to know how to program to use them.

    OTOH, a good programming book will step you through on HOW to use the various functions, not just what the functions do. Things like layering, magic number constants, security etc.

    --

    - - - - - - - - - - -
    I am a programmer. I am paid to produce syntax not grammar. Deal with it.
  8. Re:Needed? (Obligatory reply) by Frymaster · · Score: 5, Insightful
    Online documentation is also ugly and hard to read.

    yes, but....

    1. it is always up-to-date
    2. it is complete, ie it archives older versions and deprecated calls
    3. it has user comments usually (php.net's user comments have saved my ass at least twice)
    4. it is free
    5. it weighs nothing. when you walk to work, this counts.
  9. Re:Needed? by Anonymous Coward · · Score: 3, Insightful

    Maybe because PHP5 isnt finalized yet? Kinda stupid to update comprehensive docs for a changing beta...this book would've done better for wait for 5's final release.

    Your comment is rather disjointed, were you trying to link between online docs being unreadable and php5 docs not being online, while claiming the book is exactly opposite, with easy to read PHP5 documentation? Or do you just suck at typing?

  10. Re:The online PHP documentation could be improved by Crewd · · Score: 4, Informative

    You mean there isn't a page like this one?

    http://php.net/quickref.php

  11. PHP Cookbook from O'Reilly by Anonymous Coward · · Score: 5, Interesting

    I gotta agree with the poster above.. O'Reilly's PHP Cookbook is an excellent way to sharpen your PHP skills.

    I've recently gotten back into using PHP for medium-size sites, after a brief period of hating it. I hated the security problems, the "fake" OO, the arbitrary stuff like magic quotes, the procedural functions. However, I've changed my opinion a bit: in security, you can have the PHP engine OFF and very tight in the .ini, and then make adjustments in the httpd.conf for each customer. I.e., just let them open files in their own directories. And the OO is simple but effective enough for clear maintainable code. Throw in a PHP accellerator and you've got a great environment.

    PEAR (object-oriented extension library) is pretty cool. If you've never used it, try it out: "wget -O- http://go-pear.org/ | php -q".

    And PHP5 looks great, I love the fact that it has exceptions, interfaces, and type hints, that will pretty much kill Java on the medium/small end of the scale. So I decided to start using PHP again.

    Anyway, the only good book I've seen is the O'Reilly Cookbook. They totally missed the PHP bandwagon but they redeem themselves with this one. It's clearly written, very thorough, and includes recipes of all levels. I learned a lot about PHP just by reading through the recipes. They usually present one clear way to do everything, plus make some useful discussion on performance and security when appropriate. The authors cleary understand PHP deeply.

    And the book is pragmatic, unpretentious, and clearly designed to help you get your work done, rather than present a list of "my language is cooler than yours" tricks. Unlike certain others *cough* Python cookbook *cough*. (Granted, that's also a property of PHP itself).

    So if you've got the basics of PHP (which you can glean from the PHP web site or from studying other people's code), try the O'Reilly book. It's probably the only one you'll need until PHP5 comes out.

  12. Re:The online PHP documentation could be improved by dark_panda · · Score: 3, Informative

    I'd suggest taking a look at this page:

    http://www.php.net/mirroring.php

    I've set up a mirror for internal use at work. Just run rsync in a cron job every week or month or whatever to keep things up to date.

    J

  13. Real programmers only write in... by Saeed+al-Sahaf · · Score: 3, Insightful
    "Real programmers only write in..."

    ...the language most appropriate for the particular project?

    --
    "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
  14. Technical Writing by JediDan · · Score: 5, Insightful

    "One of my key concerns when reviewing a good book is the pull between information density and a light, easily read style. I believe that as we get further along the learning curve we can sacrifice some readability for density -- we want more facts and less explanation."

    You've just described some of the basics of good technical writing. The basic theory of writing good technical documentation is identifying your audience and writing so not only does the document answer the audience's questions and provide usefully comprehensible information, but also refers the more literate and technical readers to more detailed sources.

    Anyone aspiring to be a writer - either professional or just notating code - should take a few technical writing classes. There's an industry that's refined the process of technical writing and there's no sense to reinvent the printing press - so to speak.

    --
    - Dan
  15. With PHP5, why not use Perl? by waxmop · · Score: 3, Interesting
    PHP appealed to a lot of people because it was very simple and had limited syntax and didn't implement a lot of complicated data types. PHP was the kind of thing a non-programmer could learn in an afternoon. You didn't need to explain regular expressions, object-oriented design, or pointers/references. PHP originally just had loops, conditional statements, simple functions, and include statements.

    But every version has added on more features. Now instead of a smooth and light templating language, people are now writing templating languages to be parsed by PHP. Gahh! The proper response to all the trolls that insult PHP by saying that it isn't a real language is not "Wait until version 5! It supports class introspection!" Instead, the PHP community should have said that PHP wasn't meant to be a "real" language.

    Now that PHP requires a 1000-page book, why should it exist? Why not use Perl, or Python, or C?

    I will say that the PHP community is a very friendly and helpful group of people. Perhaps that is because so many PHP developers were previously graphic designers, and so they still remember how daunting programming can be to learn.

    1. Re:With PHP5, why not use Perl? by SmallFurryCreature · · Score: 4, Insightful
      Simple.

      Perl is a great tool. But it is more of tool to use on files then a tool to create webpages. Using perl to generate html or rather bits of html is like using a fully loaded factory workshop to hammer in a nail. Overkill.

      Python. No idea.

      C? You gotta be kidding. Compiling each time you make a change to page? C would be like using nanotech to create a new material from wich you can cast a hammer to insert a thumbtack. Overkill doesn't even begin to describe it.

      PHP may have gotten big but at its heart it still does the same what it did originally. Make dynamic websites. Sure you can mess with OO a bit and a lot more in 5 but if you don't want you never need to touch it. You don't need to access any database. You don't need to use shared memory to store variables. But you can if you want to.

      Perl is often used but approaches it from the other side. Great toolset with web added on. PHP is web with a great toolset added on.

      Of course real web developers know both.

      --

      MMO Quests are like orgasms:

      You may solo them, I prefer them in a group.

    2. Re:With PHP5, why not use Perl? by monique · · Score: 4, Insightful

      I disagree. Coldfusion is the kind of thing a non-programmer can learn quickly.

      PHP has always looked too much like shell scripting or C to be friendly to non-programmers. I love PHP precisely because it is extremely easy for a *programmer* to pick up, but has a lot of functionality with which you can improve your naive first implementation.

      My first PHP programs involved lots of calls to external apps, particularly grep and find. That ability allowed me, as a unix-tool-using programmer, to quickly hack together PHP that I could later improve. But I can't imagine picking up PHP as a non-programmer and having the first clue how to use it.

      --
      -monique
  16. Good book but... by 2Wrongs · · Score: 4, Interesting
    I used this book as my intro to PHP (I've done several other languages). Overall the book was good, but I had some problems:

    1) I loved the objected oriented aspects, but was disheartened to learn most of that code only applies to the latest PHP, which isn't deployed in most ISPs.

    2) The index is terrible. Thank God the online docs are good. I've rarely been able to use the book as a reference.

    3) I'm probably being dense, but I had trouble finding the sample code online. I expected it on Prentice Hall's website or at least an obvious link. (It's on the author's site)

    I'm whining, but I really did like this book and would still recommend it.

  17. Re:Sorry, but this is fucking stupid. by hyperstation · · Score: 4, Insightful

    bs. a new programmer should have to worry about everything that is going to affect the readability of his code in the future when he's an advanced programmer.

    it's hard, very hard to break the bad habits instilled in "new" programmers. get em while they're young. that's why i like the fact that python *forces* good form and whitespace. just the notion that it won't work if it's not properly formatted will carry over to other languages when someone moves on to another language, and good style will as well.

    understanding the difference between tabs and spaces isn't something too hard for anyone attempting to learn a programming language to tackle.

    the parent is gonna get un-modded for this, but i just had to say something...

  18. Re:The online PHP documentation could be improved by SvendTofte · · Score: 4, Informative

    Also, when you want the lowdown on a function, it's super easy to just enter

    www.php.net/functionname

    into your browser, and you're forwarded straight to the functions documentation, and usually also the local mirror. Sweet stuff.