Become a fan of Slashdot on Facebook

 



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

Learning PHP 5 201

John Suda writes "There are more new books being published about PHP than you can shake a joystick at. PHP (along with program friends - MySQL and Apache) has become very popular among developers and web designers, and for good reason. As a programming language, it is particularly suited to web development projects, while being relatively easy to write, use and learn. More importantly, it's open-source and free, cross-platform, and widely supported. David Sklar's Learning PHP5 is one of the latest volumes dealing with PHP. It describes itself as 'a Pain-Free Introduction to Building Interactive Web Sites,' and provides a gentle introduction to the latest version of PHP, which is version 5 and only recently available." Read on for Suda's review.
Learning PHP 5
author David Sklar
pages 432
publisher O'Reilly
rating 9
reviewer John Suda
ISBN 0596005601
summary An accessible introduction to the popular web scripting language PHP

This book is not particularly useful for those experienced already with PHP, nor for those wanting to upgrade their knowledge of PHP from versions 4 and earlier to the newest version. It's also probably not particularly useful for those power programmers who need and want a deep and comprehensive coverage of the topic. But it is a very well-written and designed introduction to PHP 5 for beginning programmers or those experienced PERL, ASP, or Cold Fusion programmers who want to learn a different language. There are many illustrations and code samples sprinkled throughout the book. Sklar, however, skims over some topics, concentrating instead on practical examples.

The publisher is O'Reilly Media, Inc. which seems to have an editor's policy of covering complex computer-related topics in a comprehensive manner by publishing a range of volumes covering different aspects of a topic or from different angles or for different audiences. O'Reilly also publishes volumes on moving to PHP 5 (Upgrading to PHP 5), detailed and technical PHP (Programming PHP), and a collection of solutions to common PHP programming problems (The PHP Cookbook).

Sklar is an experienced consultant in computer software development and technical training. He is the author of Essential PHP Tools and coauthor of the aforementioned The PHP Cookbook. He takes a deliberate and comprehensive approach to explaining PHP 5, not in great depth, but with the intent of providing enough information, concepts, detail, and scope to create a pleasant and useful read of a technical subject. The basic promise of PHP is in the relatively easy creation of more dynamic and interesting web sites which would include, for example, product catalogs, blogs, photo galleries, event calendars, forms, and more.

There are 13 chapters and 3 appendices. The early chapters provide an orientation to PHP, including its place in contemporary web development, its basic rules, and its syntax. They explain the basic background of PHP and how it interacts with the browser and web server. Later chapters introduce primary concepts like loops, arrays, and functions. The idea here is to facilitate learning the fundamentals of the grammar and vocabulary. Chapters 2 through 12 have short exercises at the end of each to allow the reader to practice writing PHP code and to test learning. (The answers are contained in Appendix C.) Experienced programmers and geeks may recoil at the inclusion of these exercises, but they are useful for beginners.

Chapter 6 provides a practical exercise - how to make and use a web form. The author shows how to access form variables, how to validate user-inputted data for security and efficiency reasons, and how to process forms using functions. Chapter 7 shows how PHP interacts with database programs, like SQL and Oracle, but focuses primarily on MySQL, and demonstrates how to organize data, connect to a server-based database, create tables, and enter and retrieve data.

The rest of the middle chapters cover the use and implementation of cookies and sessions, handling dates and time, and working with files. The practical exercise using dates and times is creating and displaying a monthly calendar. The final chapters provide brief but practical coverage of XML, debugging, and in Chapter 13, other PHP aspects. PHP is amazingly useful, flexible, and practical. One can deal with graphics, PDF documents, and other media like Flash and Shockwave. It also has mailing and file uploading functions, encryption capabilities, and (for more experienced coders) the ability to run shell commands. The upgraded PHP 5 has new capabilities, which now include object-oriented programming.

Appendix A covers installing and configuring PHP for Windows, Mac OS X, and Linux; Appendix B is a short primer on regular expressions and how to use them with PHP.

I found the book to be the most accessible introduction to PHP I have read. It provides the basic fundamentals, engages the reader in practical examples, reinforces learning with exercises, and provides an overall perspective on the scope of PHP programming.


You can purchase Learning PHP 5 from bn.com. (Code examples used in the book can be downloaded at the O'Reilly site for the book, linked above.) 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.

Learning PHP 5

Comments Filter:
  • by prostoalex ( 308614 ) on Thursday October 28, 2004 @05:33PM (#10657929) Homepage Journal
    For the beginners it's worth noting that two PHP books are available for free on the Web (outside of PHP.net documentation).

    A Programmer's Introduction to PHP 4.0 [apress.com] from Apress

    Practical PHP Programming [hudzilla.org] online book

  • by jbellis ( 142590 ) <jonathan@carDEBI ... com minus distro> on Thursday October 28, 2004 @05:43PM (#10658015) Homepage
    ASP.NET is infinitely better designed than classic ASP. (Not perfect by any means -- ASP.NET should be next to "leaky abstraction" in the dictionary -- but they got a LOT right this time around.)

    PHP5 has more features than PHP4 but is aggressively backwards compatible, thus, with a few exceptions it's as crufty as ever.

    I would pick OpenACS [openacs.org] over ASP.NET but I would pick ASP.NET over PHP5 or most J2EE stacks.

  • I read it (Score:5, Informative)

    by Jack9 ( 11421 ) on Thursday October 28, 2004 @05:56PM (#10658119)
    When this PHP book appeared in Border's Books last week I read through it to make sure I was still up to speed. I've been programming PHP since 2.0 (back when you could go on IRC and talk with Lars). The book is mostly a verbose rehash of select bits from the documentation by a collection of authors. Wow, described it in one sentence. Didnt seem to have anything over the documentation on the PHP website.

    The bit on XML was interesting as I've never needed to use XML and now have a single practical example to point at.

    The book is not a 9...more like a 6. It's a professional paperback monolith and it doesnt spread disinformation. I don't know what's wrong with the reviewer *shrug* but this isn't a book I'd recommend.
  • by styrotech ( 136124 ) on Thursday October 28, 2004 @06:09PM (#10658227)
    Absolutely not. ASP is a scripting language. PHP is a scripting language with string OOP features. ASP.net is a framework for the web, which allows you to use a fully featured OOP language such as C#.

    The original ASP wasn't a language, it was a framework too. You could write ASP pages in vbscript, jscript or even perl.
  • by GnuVince ( 623231 ) on Thursday October 28, 2004 @06:31PM (#10658383)
    I agree! I recently started playing with Rails, and man it's the funnest thing to build web-based applications! It's easy, fun, simple (you have less code in your controller than some frameowkrs have just for their XML configuration files) and it works very well and very naturally!
  • by rainman_bc ( 735332 ) on Thursday October 28, 2004 @07:08PM (#10658665)
    Woah silver - Have you LOOKED at PHP5 recently? Inheritence, Overrides, Private Methods and properties, static methods. Looks like a pretty good implementation of OOP.

    And for those zealots who bitch about the fact that everything's a function, dive into Pear...

    The only thing that'll keep php5 from getting into the mainstream is the fact that it doesn't offer too much more other than a much better implementation of OOP, and default installs don't have the mysql package by default - they only have imysql, which means there's a lot of apps out there for php4 that won't work on a default php5 install. Keep in mind in hosted environments this can be a bit of a problem.

    Keep in mind that mysql4-stable doesn't work with imysql yet AFAIK.

    I love PHP5, but the lack of default support for the standard mysql package is bad for many existing apps that rely on that package.

    (yes the onus is on programmers to get their code updated to something like, oh, adodb maybe?)
  • Re:PHP or Perl? (Score:3, Informative)

    by Camel Pilot ( 78781 ) on Thursday October 28, 2004 @07:30PM (#10658830) Homepage Journal
    But probally the main reason me and lots of other people who prefer PHP hate perl is CPAN. CPAN is the perl libraries which you always end up having to update and it can sometimes be a big pain in the ass.

    Uh? >perl -MCPAN -e "install mymodule"

    which will also track down dependencies and install those too.

    Can it be any easier? Activestate has their own set of tools to do the same.

    And you typically install or update modules because there is some spiffy module like Net::SFTP, Math::VectorReal or AI::NeuralNet that provide an amazing amount of functionality in an easy to use interface. CPAN is actually the reason a lot of folks use perl.

  • Re:PHP or Perl? (Score:3, Informative)

    by Camel Pilot ( 78781 ) on Thursday October 28, 2004 @09:14PM (#10659473) Homepage Journal
    I distribute my perl code with the required modules relative to the directory where the application lives. Now all you have to do is add something like this to your code

    use lib ./my_module_dir;

    or

    push @INC, './my_module_dir';

    and perl will look in your private locations for required add-on modules.

    This model of installing modules as needed for a parser is unlike most other languages, and is something most people haven't taken too

    Actually it is similar for every other language including compiled C when using dynamic shared libraries. If you are using additinal modules or libraries you will need to distribute them with code base or be sure they are install in the system area.
  • php5 Host ? (Score:1, Informative)

    by Anonymous Coward on Thursday October 28, 2004 @10:03PM (#10659706)
    We found a really good php5 host if anybody is looking. These guys seem to know their stuff.

    http://www.a2webhosting.com/ [a2webhosting.com]
  • More PHP suppliments (Score:3, Informative)

    by kuzb ( 724081 ) on Friday October 29, 2004 @03:18AM (#10661079)
    For those interested, I wrote a PHP manual suppliment called phpbar [nullcreations.net] that works in your browser too.

    Yes, yes, it's a shameless plug, but I had a lot of fun putting it together ;)
  • Re:Any good IDEs? (Score:2, Informative)

    by CultFigure ( 563155 ) on Friday October 29, 2004 @11:20AM (#10663246)
    Zend Studio [zend.com] is excellent... well, it's better than anything else I've used over the last 5 years - pico, vi, emacs, Dreamweaver, Quanta, Jedit. It's well worth the money and runs on OS X. If you're on the cheap, go with JEdit and install the PHP plugin.

"I've seen it. It's rubbish." -- Marvin the Paranoid Android

Working...