Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



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

Spring Into PHP 5 229

Michael J. Ross writes "A professional programmer could at any time be tasked with developing a nontrivial application using a language or Web technology with which he or she is unfamiliar. A common response is to quickly scan code snippets in Internet newsgroups and online tutorials, copy and paste code that looks applicable to the task at hand, and then lose valuable time trying to make it all work and control what was created -- not unlike Dr. Frankenstein's experience. A smarter approach is to learn the language basics in sequence as rapidly as possible, not getting bogged down in excessive sample code. For developers seeking to learn PHP using the latter approach, Steven Holzner's Spring Into PHP 5, published by Addison-Wesley, would be an excellent choice." Read on for the rest of Ross's review.
Spring Into PHP 5
author Steven Holzner
pages 340
publisher Addison-Wesley
rating 8
reviewer Michael J. Ross
ISBN 0131498622
summary A comprehensive and no-nonsense primer on the basics of PHP.


This title is another entry in Addison-Wesley's promising "Spring Into" series, which, as suggested by the name, is aimed at developers who want to jump into a new technology and get up to speed as quickly as possible, but without missing any of the essentials. In the case of Holzner's PHP book, this goal is pursued by presenting the information in so-called "chunks," with each spanning just a few pages. Every chunk attempts to cover only one or a few related ideas, and is designed to build upon earlier chunks. The bulk of the explanation takes the form of code samples, which fortunately are short enough in length and clear enough in composition to be easily digestible. This is in stark contrast to far too many other programming books on the market, whose code samples can span multiple pages, making it difficult for the reader to discern all of the ideas that the author is trying to get across -- especially when the reader has to flip back and forth between pages. Even worse is how some authors (such as Deitel and Deitel) use lengthy code listings -- sometimes even complete applications -- to demonstrate many ideas at once, which can be quite confusing, especially for the newbie reading about a challenging language for the first time. As Holzner notes in his preface, his book is example-oriented, with dozens of tested code samples. But none are overwhelming.

Spring Into PHP 5 was published on 12 April 2005. It is organized into nine chapters, covering a range of topics: PHP essentials; operators and flow control; strings and arrays; functions; PHP in HTML pages; Web forms and input validation; object-oriented programming and file handling; PHP and databases; cookies, user sessions, FTP, e-mail, and hit counters. The book has two appendices. The first one, on PHP language elements, is remarkably complete, considering that it only fills 18 pages. Owners of the book will likely find themselves turning to this material quite frequently. The second appendix lists the most commonly used functions in PHP, particularly those dealing with arrays, strings, and files. These two appendices combined go a long way to making this book more than an approachable primer -- it could serve as a reference book for the language for any reader not required to dig into the more obscure intricacies of PHP. Readers with those needs will have to use more detailed sources, such as the online PHP Manual.

Each one of Holzner's chapters explains the core concepts, using the bite-sized chunks mentioned earlier. This approach is somewhat similar to the "recipes" found in many books published by O'Reilly Media, and it works well here for introducing a computer language. Holzner's writing style is clear yet never condescending, and concise yet never cryptic. The intended reader only really needs an understanding of simple HTML and how to edit text files, to make this book worthwhile and usable. The book is meaty with information, and yet not too lengthy. This is a refreshing change of pace from countless other computer language books that are bloated with redundant sample code and overly wide margins, apparently in an attempt to entice the consumer with maximum page count per dollar.

Some programming books try to move the novice along at too rapid a pace, which can get quite discouraging if and when the reader is unable to follow the discussion, and particularly if trying to follow the author in building a working example. But a far more common mistake among programming books, is to drag out the process with humongous code listings or redundant verbiage (such as following the senseless rule of telling the reader something three times -- a technique that makes far more sense for speechwriting). Holzner sets and maintains an excellent pace, partly by keeping the code snippets reasonably sized, and partly through his modular approach of presenting ideas in chunks.

The physical book itself is well made and attractive, with a readable font face and size, and intelligent use of bolding to highlight those lines of code upon which the reader should focus. My only complaint in terms of the presentation, is that the gray background used for the code samples could be lightened up a bit, to make the text itself stand out more, especially the bold text. All of the screenshots are in black-and-white, which works just fine, as there would be no value in using color in the majority of the sample Web pages.

The author does an excellent job of explaining and illustrating all of the most commonly used and needed elements of the language. But he provides little guidance as to when a particular technique or approach should be used over another. For instance, when explaining how the programmer can use PHP to connect to a MySQL database, the author presents two alternatives -- direct layer and Pear::DB -- but no recommendations as to the choice of one over the other. On the other hand, one might argue that to include recommendations of techniques, as well as language best practices, would require the book to be much longer than it is, which would detract from the book's goal of getting a programmer up to speed on PHP in an efficient manner. The serious programmer who wishes to take PHP to the next level, can be expected to read more advanced books, to learn from expert PHP developers posting in online newsgroups, and to learn from experience as the programmer creates his or her own applications.

Another potential point of criticism could be that the book does not adequately explain how to use PHP with the various available database systems, only covering MySQL (the industry's favorite for use with PHP). But the database chapter, number 8, provides just enough information for the beginner to get started and to try out the basics. For simple database needs, the material in that chapter might be sufficient. Yet for more extensive MySQL usage, including installation and administration, other resources will need to be consulted. This book is clearly not intended to be one of those PHP + MySQL combo books that have proven so popular during the past few years.

The publisher's Web site for the book does not appear to have any collection of errata. Here are some that I found: On page 6, in the NOTE, "scripts can be used" should read "scripts cannot be used." On page 20, "#/ message to the user" should read "# message to the user." On page 49, in Table 2-4, in the last line, the formatting is partly wrong. Examples 3-1 through 4-14 contain incorrect indentation. On page 158, the last line in the $_FILES['userfile'] values is missing $_FILES['userfile']['error']. In Examples 5-19 and 5-20, the <head> and <h1> tags are missing ": Take 1." On page 169, the formatting of Example 6-2 is inconsistent with the others.

Aside from the errata, there were some other weaknesses -- none of them serious: The chapter summaries are useless, like in most other technical books, as there's not enough details to be instructive, and more details would make them even more redundant and space-consuming. On page 176, in Figure 6-6's caption, "Navigating" should be "Redirected." On page 197, the discussion of HTTP authentication is too brief to enable the typical reader to implement it. For instance, there is no mention of where to set $_SERVER[ 'PHP_AUTH_USER' ] to make it work. Chapter 7, on object-oriented programming and file handling, should be split into two chapters. Combining them makes no sense, and the author does not even transition from the first topic to the second.

Like others in the "Spring Into" series, this title is reasonably priced, at only $29.99 list for over 300 pages of quality material. The publisher, Addison-Wesley, has a page on their Web site devoted to the book, which includes a book description, a table of contents, an index, source code from the book, and a link for downloading a sample chapter (in PDF format), namely, Chapter 3, which covers strings and arrays. The site also has a link to a bonus chapter (also in PDF) that explains how to draw graphics interactively on a Web server and then send them back to the browser. Oddly enough, the page's title is "Spring Into PHP 5 - $20.99," but there's no indication as to how to get the book for only $20.99. That could simply be a typo. But there is a link to purchase the book online for $26.99. For those looking to spring into Web server-side development in general, or PHP in particular, it would be money well spent.


Michael J. Ross is a freelance writer, computer consultant, and the editor of the free newsletter for PristinePlanet.com. You can purchase Spring Into PHP 5 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.

Spring Into PHP 5

Comments Filter:
  • wtf? (Score:2, Insightful)

    by Karaman ( 873136 )
    A professional programmer will never do the stupidity described in first paragraphs when dealing with new language and/or tool to perform task at hand. Although the book might be the best for beginners and advanced users, A PROfessional will not need it at all.
    • Pretty Home Pages (Score:2, Informative)

      by Mateo_LeFou ( 859634 )
      I remember this book ... it was terrible. It contained NOTHING specific to PHP5's features. Also it was terrible. It was full of
      echo "TD> blah blah blah /td>";
      echo "TD> and so on /td>";
      echo "/TR";
      echo "/TABLE";

      ick.
      And I remember somewhere it said PHP stands for "Pretty Home Pages"
      wtf indeed.

    • Whoa i worked with people who would copy stuff off the web, fail to understand it and spend 10x longer trying to get it to work than it would take a real developer to just write it.

      Still, professional programmers probably don't use PHP at all - i've never met one who does.
      • Re:wtf? (Score:4, Insightful)

        by tha_mink ( 518151 ) on Thursday August 11, 2005 @06:35PM (#13298930)
        Still, professional programmers probably don't use PHP at all - i've never met one who does.

        So then, all the enterprise PHP you see out there (that's right I said enterprise PHP) must be written by amatures?) So like...Yahoo is just a bunch of retards? [yahoo.com] Do you not notice how much of the really advanced web-apps are php these days? It's like some guy who writes machine code saying..."yeah....perl is just for dummies". Cmon Idiot!

        A better point would be that PHP is so easy to learn and flexable enough to do POORLY, that anyone with a logical brain, a book, and a text editer can "code" a simple widget.

        PHP is here to stay. Get over it!
  • This book is clearly not intended to be one of those PHP + MySQL combo books that have proven so popular during the past few years.

    So, even though most people use PHP + MySQL and books of the type have been popular this one doesn't do that.

    Another potential point of criticism could be that the book does not adequately explain how to use PHP with the various available database systems, only covering MySQL (the industry's favorite for use with PHP).

    But yet it does explain MySQL? Which is it? I'm not going t
    • If the reviewer is really that confused, it might not be a good idea to take any of the points he makes too seroiusly.
      • If the reviewer is really that confused, it might not be a good idea to take any of the points he makes too seroiusly.

        Are you inferring that the reviewer thought the book was a joke and that I should assume that from what he wrote?

        I took a look at the header above his confused review and saw that he rated it an 8 (I assume out of 10). If you are really inferring that I shouldn't take his review "seriously" and that I should instead assume he was joking around about the book perhaps he should have rated it
    • Reviewer: "Another potential point of criticism could be that the book does not adequately explain how to use PHP with the various available database systems, only covering MySQL (the industry's favorite for use with PHP)."

      Parent post: "But yet it does explain MySQL? Which is it? I'm not going to buy the book if the reviewer can't figure it out."

      The reviewer is saying the book explains how to use PHP with the database program MySQL, but not with other database programs such as Lotus Notes or Oracle.
      • Read the first line of my post:

        This book is clearly not intended to be one of those PHP + MySQL combo books that have proven so popular during the past few years.

        So, if it's not meant to be a PHP + MySQL book and it's not showing the other options what exactly is the book doing? The reviewer doesn't know.

        Thanks for proving my point.
        • Pedantry is annoying. Misguided pedantry is a hundred times worse.

          "The book is clearly not intended to be one of those PHP + MySQL combo books" : The book does not have a heavy focus on MySQL.

          "For simple database needs, the material in that chapter might be sufficient. Yet for more extensive MySQL usage, including installation and administration, other resources will need to be consulted." : The book covers MySQL, but not in too much depth.

          "...the book does not adequately explain how to use PHP with the
    • This book is clearly not intended to be one of those PHP + MySQL combo books that have proven so popular during the past few years.

      [...]

      Another potential point of criticism could be that the book does not adequately explain how to use PHP with the various available database systems, only covering MySQL (the industry's favorite for use with PHP).

      But yet it does explain MySQL? Which is it? I'm not going to buy the book if the reviewer can't figure it out.

      In other words, the book isn't centered around

  • by joelparker ( 586428 ) <joel@school.net> on Thursday August 11, 2005 @03:12PM (#13297256) Homepage
    >A smarter approach is to learn the language basics in sequence as rapidly as possible

    In my experience a language becomes useful when you also learn the frequent idioms and know the available toolkits.

  • by mabu ( 178417 ) on Thursday August 11, 2005 @03:12PM (#13297262)
    A smarter approach is to learn the language basics in sequence as rapidly as possible, not getting bogged down in excessive sample code.

    Excuse me? Maybe I'm an anomoly, but I can't think of a better way to learn a language than by example. This suspiciously sounds like and excuse to cover up the fact that the book doesn't offer adequate material to show how one can code in real-world environments.

    When I look for a good programming book, be it an introduction, advanced tutorial or reference, the use of lots of examples is one of the main standards by which I judge the value of the publication.
    • yeah but too much isn't good either. The last thing you want is crawling through pages of example code while it can be explained just as well in only a few lines.

    • I don't know... I rather enjoy learning by counter-example.

      Though I imagine for a beginner those nasty regexs of invalid code could bog you down a bit...
  • PHP vs Ruby On Rails (Score:2, Interesting)

    by CatGrep ( 707480 )
    I'd like to see more comparisons between the two. At this point, it seems to me that if one were just starting out in web programming they might be better off going with Ruby On Rails. I don't see any advantages for PHP now.
    • by Anonymous Coward
      Hmm lets see, time to compare a Web programming language vs a Framework.

      Now you could compare Ruby to PHP or Rails to an mvc PHP framework like Cake.

      But PHP against Ruby on Rails is Apples vs Oranges.
    • I haven't used Ruby, but here's the advantages I can think of for PHP. How does Ruby stack up?

      1) PHP is the most common. I don't care what the Slashdot summary says, I like being able to find code snippets that have already solved the problem I have.

      2) Corollary, PHP runs everywhere. Whatever the hell webhost the client went with, it probably already has PHP installed.

      3) PHP is blindingly simple. If you're coming into web programming from desktop programming, you already speak C, and PHP is like C with anyt

      • PHP is blindingly simple. If you're coming into web programming from desktop programming, you already speak C, and PHP is like C with anything remotely complicated taken out.


        "@" is a special character in PHP, used before a function call, to supress errors from being directly printed. That is about as un-simple as you can get in my opinion. There are all sorts of strange, inconsistent, or overly-specific aspects to the language. PHP is not even remotely like C, except for the { }.
  • ....php was, for me, the easiest language to pick up. There's a plethora of built in functions to help you do just about anything and the syntax is like a hodgepodge of other languages best points put together. Maybe not everyone feels this way, but it's definatley in my top 5 favorite languages to write in. The only book(s) i think any programmer needs to pick up PHP are the visual quickstart guides from peachpit press. (shameless plug i'm afraid, but i love their stuff.)
    • I second this. I've done PERL BASH, a couple crappy C, yadda yadda. and I was able to pick PHP in an afternoon. Especially with it's similar structure to PERL.

      I use php for most everything now, especially since php-cli came out. I even write my shell scripts in it now.

      A few weeks ago I had to write a site that would allow users to input obituaries (I work in newspapers) and send off an XML feed and any binary images to an FTP server. The cool part is that the SAME script can be run from a command lin
      • nice. I also used to write all my shell scripts in PHP as well. I changes jobs to more of a data-mining position so i dont do it anymore, but it was incredibly useful. I did all sorts of string manipulation and stuff as well. One of my favorite things was using the functions that would open a file as an array of strings. One element for every line in the file. It makes flat file information storage a snap... I wrote a script that would open snort logs and sort through them for things of interest, dec
  • PHP book reviews! Considering that there seems to be about 1-2 week, it would be a pretty good size topic.
    • i dont know which alternate-weirdland-slashdot you read, but here, in this dimension the last php book was on Jun30 [slashdot.org]. and before that Mar23 [slashdot.org]. id hardly call that a `pretty good size topic'. maybe you should go back to trolling the google threads, as you probably think they are a `pretty good size' too. but what can you do, google has already got a topic [slashdot.org].
  • by CyricZ ( 887944 ) on Thursday August 11, 2005 @03:37PM (#13297505)
    There was some discussion here at Slashdot a few days ago in another topic regarding the effect PHP is having on the reputation of Linux. Considering that it is often grouped with Linux in the LAMP model, and is also one of the more well-known open source projects, there has become a close assocation between the two in the eyes of the general public.

    Now it's no secret that PHP has suffered from some pretty serious security issues as of late, such as the XML-RPC flaw. Then there are the routine problems of poorly developed blog and CMS systems being defaced. Many of these problems are attributed to inexperienced users writing what amounts to completely horrible code.

    While the developers of PHP itself are very talented and quite respected, the users of PHP are starting to cause problems for the Linux community as a whole. Each time a site is defaced due to some poorly written PHP script, it is often portrayed as a vulnerability with Linux itself. Of course that is more often than not a complete falsity, as the fault does not lie in any way with the Linux kernel or its developers.

    So while Linux advocates often promote the use of PHP for developing webapps on Linux, PHP is starting to become more of a liability. Every site running Linux and PHP that gets defaced due to terribly written PHP scripts reflects very poorly on Linux's public image. Now I have to ask: what is the Linux community willing to do about this problem?

    Would they even be willing to go so far as to demand that the PHP developers include functionality to severely limit the ability of faulty scripts to run? It's quite difficult to say at this point. But if changes aren't made fairly soon, then things could degrade very quickly.
    • This is the most rediculously stupid comment I have ever seen. It makes a series of statements as fact, without any proof.

      It also makes claims of a solution which is incomplete. WTF? 'Would they even be willing to go so far as to demand that the PHP developers include functionality to severely limit the ability of faulty scripts to run?'

      Demand to make C programs unable to be hacked.
      Demand that perl programs are unable to be hacked.
      Demand that assembly programs are unable to be hacked.

      How about looking at
    • So while Linux advocates often promote the use of PHP for developing webapps on Linux, PHP is starting to become more of a liability. Every site running Linux and PHP that gets defaced due to terribly written PHP scripts reflects very poorly on Linux's public image. Now I have to ask: what is the Linux community willing to do about this problem?

      I know! Linux advocates should promote the use of PHP for developing webapps on Windows!

    • by maelstrom ( 638 ) on Thursday August 11, 2005 @05:57PM (#13298712) Homepage Journal
      The solution is to enable SELinux for Apache and only allow those PHP scripts access to their own files. Then even if there is an exploit for the poor written PHP code, the amount of damage it can do will be minimal.

  • by scottsk ( 781208 ) on Thursday August 11, 2005 @03:37PM (#13297507) Homepage

    I am not knocking this book by any means. It is probably very good. But can't any developer who knows a C-ish syntax language pick up PHP basics quickly? I learned it in a day or two just by analogy with C/Perl/etc. How much need/demand is there for entry level books like this?

    Where computer books have value to me is when they teach me something that would take hours/days/weeks to learn by trial-and-error. Something non-trivial that can't be guessed from reading the doc. (Like setting up user authentication or something.) That's when I start thinking about spending cash on books which have value by saving me time and especially frustration. (The PHP Cookbook, for example.)

  • Without any evidence at all.

    A smarter approach is to learn the language basics in sequence as rapidly as possible, not getting bogged down in excessive sample code.

    Define "excessive". And why is that way smarter?

    Learning by example is a pretty common pedagogic approach after all.
  • Wait, there is still a programmer that doesn't know PHP?

    color me stunned!

    -mix
  • Tasked (Score:2, Funny)

    by NickF ( 680075 )
    A professional programmer could at any time be tasked

    tasked
    Must be an MBA.
  • by kenh ( 9056 ) on Thursday August 11, 2005 @04:02PM (#13297763) Homepage Journal
    and I've noticed a few things that don't bode well for the book (in no particular order):
    • Lack of labels on early figures/diagrams I noticed that some of the first chapter examples and diagrams were not labeled correctly.
    • Program names in examples don't match text (or vice-versa) The text will refer to an example with one name, but the actual screen print has a different name - not a huge deal, but combined with the previous point, it is a problem.
    • Handfull of errata in first few chapters none really major, but the sum total makes the reader feel the publisher rushed the book.
    • Instructional method not a good fit for early material The examples in the first few chapters are trivial, and strain the idea that this boo is aimed at anyone with programming experience. I would have prefered one big chapter that ends up with one, more complex example.
    • No common theme to examples Again, I'm only in the first few chapters, but the author keeps introducing new premises for the examples - in contrast, the IMS/DB books I read back in my mainframe days all relied on examples from the hospital domain - the lack of consistency across the examples is a distraction to the reader, who has to endure new "let's pretend your a..." setups for each new topic.
    • Inconsistent editing From my quick review of the last few chapters of the book, many of the above complaints are corrected, which makes me wonder about the editing/technical reviewing done on the manuscript.

    Overall, this is a pretty good idea for a book, but the editors/author should not have rushed it to press - the quality of the book appears to have suffered.

    I would strongly encourage a potential buyer of this book to spend several minutes with the book and see if the style suits your manner of learnig. Personally, I prefer the O'Reilly Learning series [oreilly.com] approach to teaching a topic, but preferences vary.

  • by DigitalBlossom ( 906945 ) on Thursday August 11, 2005 @04:05PM (#13297800)
    The only book anyone should be using for learning PHP is the PHP manual. We write it for a reason. The manual is the only resource I know of which is almost always up to date, maintained, and largely error free (We have errors, but as soon as they're reported they are fixed, usually within hours of the report being filed. Most of these types of errors involve spelling or gramatical mistakes.). Books released on the subject all do the same thing: re-write what the manual has already adequately stated while throwing in errors left and right.

    Arguably, there are a few books written which at first seem to be written well. Hell, who isn't tempted to pick up a book now and again which has names such as "Rasmus" and "Andi" etc stamped across the front in large gaping print. But these books are just as useless as those written by lesser-known authors, and shouldn't be used because of the same failings of other books: They're error-prone, and almost immediately deprecated. PHP changes rapidly, very rapidly. Possibly too rapidly for its own good, but that's another discussion entirely. Point being that you can't commit changes to the cvs repository of a book as you can to the PHP manual, and as such any printed book will fall far short of being as up to date as the PHP manual.

    If you need a resource to "teach you PHP quickly" there is generally only one chapter you need to read in its entirety, and that is php.net/langref. Anyone willing to take the time to do that can pick up the (extremely easy and basic) syntax of PHP within 2 to 4 hours. From there all one need do is hit the extension documentation pages of any API they may wish to use, such as php.net/mysql, php.net/pcre, etc.
  • I love PHP (Score:2, Insightful)

    I'm a huge PHP fan.

    But even I'm getting sick of these PHP reviews.

  • I like the idea of the Visual QuickStart Guides - I've flipped through (and bought but not yet read) the one for Python, but the one for PHP doesn't cover PHP5-specific stuff, despite the cover blurb, according to some people who've read it. Hopefully an updated version is forthcoming.

    I recently got, and am slowly going through, "Beginning PHP 5 and MySQL: From Novice to Professional," and it's okay, but no more than that. A strange ordering of what's taught when, but it's working thus far. I hope it works
  • ...copy and paste code that looks applicable to the task at hand, and then lose valuable time trying to make it all work and control what was created ...

    This is what I call "Cargo cult programming" -- when you copy something that worked somewhere else, make what look to be the appropriate changes, and hope.

    Although not admirable, I have done this a number of times. (JCL! Argh!) Sometimes you just need to make a minor change to a program in a language you don't know.

    The Jargon file has a slightly different d
  • by kstumpf ( 218897 ) on Thursday August 11, 2005 @11:34PM (#13300658)
    PHP5 is a memory hog. I realized this after writing a sizeable application in PHP5's new object syntax for our 7-server cluster. Everyone is so busy comparing PHP4 to PHP5 by benchmarking a script that prints "hello world" 5000 times, nobody has noticed the memory usage.

    PHP5 DOES runs great if you run it through Zend Platform (an opcode accelerator), which costs $1500 a year per dual-CPU server. There are free alternatives to this (eAccelerator and APC), but none of them optimize the new PHP5 class syntax like Zend, and talk of instability is common. Do some simple memory benchmarks and you will see (just load your classes, you dont even run any code it to see it guzzle memory!!).

    For us to run PHP5, it would cost over $15,000 per year, which is more than our servers are worth!

    I feel held at ransom by Zend. Small shops like us are left out in the cold. We are abandoning it and switching to mod_perl and Catalyst on CentOS4.

    PHP does not feel "free" the way Perl or Apache are. I guess it is Zend's language after all.

He has not acquired a fortune; the fortune has acquired him. -- Bion

Working...