Programming PHP
By Rasmus Lerdorf, Kevin Tatroe
First Edition March 2002
ISBN: 1-56592-610-2
528 pages, $39.95 US, $61.95 CA, £28.50 UK
Rating: :) :) :) :) of 5
PHP is a programming language that can be embedded in web pages. It makes it significantly easier to develop and maintain web pages.
This is a clear, well-organized reference manual for PHP 4. I've found it very useful.
It is not a tutorial for PHP. It does not cover PHP 5.
If you wish, checkout my somewhat longer review
This book is available on Safari Technical Books Online, if you happen to be subscribed to that service. Actually, I began reading the book on Safari; but when I saw how good the book was, I bought it.
Online Manual: If you want an on-line manual in English, I suggest trying the Online Manual on the PHP.net site. If you wish a different language and/or a different format, see PHP Documentation for a number of choices.
Some good things about the online manual are:
Some not so good things about the online manual are:
Online Tutorial: If you want a tutorial, I suggest trying Getting Started PHP Tutorial on PHP.net.
Online Searches: There's lots of PHP stuff on the web. Here's some sample searches:
site:php.net php manual site:php.net php tutorial comparison php perl php regular expression function
A Name That's Fun: The very name of PHP is fun in a geekish kind of way. It's a recursive name in the spirit of GNU. GNU stands for "GNU's not UNIX". PHP stands for "PHP: Hypertext Preprocessor".
If you think of that in the right way (wrong way?),
does that mean that, among other things, PHP stands for the following?:
PHP: Hypertext Preprocessor Hypertext Preprocessor
A Fun Blog by PHP Royalty: For a fun blog by a PHP princess, visit the Geek Fun & Humor category in the archive of a certain princess named Daynah.
A Fun Page Written in PHP: You might enjoy Random Geek Fun which is my first attempt at something in PHP that's on the net.
PHP stands for PHP: Hypertext Preprocessor. ;-)
PHP
There have been several versions of PHP. The versions you definitely need to be aware of are PHP 4 and PHP 5.
PHP 4: PHP 4
PHP 5: PHP 5
Hello World in PHP:
<html>
<head>
<title>Learning PHP: hello world!</title>
</head>
<body>
<!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
<?php
echo "<p>Hello World!</p>";
?>
<!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
</body>
</html>
Databases: I've done very little with databases.
My ISP does not provide me with MySQL which is often used with PHP.
Languages: I've made significant use of over 20 different computer languages. Not surprisingly, I'm good at learning computer languages.
O'Reilly: I own many O'Reilly books. I am generally quite satisfied with them. I'm a fan of O'Reilly.
Perl: I've been using Perl since 1994. My favorite language by far is Perl. Over the years, I've written a number of Perl CGIs.
I've used Perl a lot in my work and had one job where I worked entirely in Perl. However, I don't consider myself an expert in Perl.
PHP: I've only recently started to use PHP and have only used it a little. See A Fun Page in the left column.
I have some advantages for learning PHP
My ISP does provide me with PHP 4 and it is now enabled for my domain.
Webmaster: I've developed a number of websites and am currently the webmaster of several non-profit sites. I am definitely not a professional webmaster.
Reference: Based on the title of the book and on the Preface, I was expecting a language reference.
PHP: I was expecting the book to be focused on PHP, or, more specifically, PHP 4.
What I got and what I think you'll be getting if you get this book is a well-organized, well written reference manual for PHP 4.
Two Main Parts: I see the book as consisting of two parts
See List of Chapters in the left column for the names of the chapters and appendixes.
Language Basics: If you are like me and fairly new to PHP, I suggest working through the first 6 chapters and scanning appendix A. If you do, by the time you finish working through what I refer to as the basics, you should have a handle on the following in PHP (among other things)
The numbers in parentheses refer to chapters (or appendixes).
More Advanced Topics: There are 9 chapters and one appendix on more advanced topics.
Depending on your purpose, you can pick and choose between the more advanced topics. I focused on
As above, the numbers in parentheses refer to chapters. You likely will have different interests.
For a list that includes all the advanced chapters, see List of Chapters in the left column.
Using the Book as a Reference: I first used this book as a reference when I started learning PHP. The parts I looked at were unusually clear. It didn't seem to matter that I was new to PHP.
The index served me well and, generally, I was able to quickly find what I wanted.
Learning Specific Functions: I've learned a number of specific functions from the book that I expect to be quite useful. For example:
Learning how to Embed PHP in Web Pages: I enjoyed learning how to embed PHP in web pages. Here's an example of such embedding.
Example:
<?php
$title = "Embedding HTML";
?>
<html>
<head>
<title><?=$title; ?></title>
</head>
<body>
<p>Hello PHP World!!</p>
</body>
<html>
Notes on Example:
Output from Example:
<html>
<head>
<title>Embedding HTML</title>
</head>
<body>
<p>Hello PHP World!!</p>
</body>
<html>
Learning about Strings: Most of the programs I write are focussed on strings. The book has a whole chapter on strings. Some of the the things I learned regarding strings in PHP in that chapter or elsewhere in the book were:
Example:
The following example illustrates various styles of quoting, interpolation and printing.
<html>
<head>
<title>PHP Strings</title>
</head>
<body>
<?php
$verb = 'Hello';
$noun_phrase = 'PHP World!';
$message = "$verb $noun_phrase";
echo " <p>$message Once</p>\n";
echo <<< ENDIT
<p>$message Twice!!</p>
<p>$message Thrice!!!</p>
<p>$message Infinity Times!!! ...</p>
ENDIT;
?>
</body>
</html>
Notes on Example:
Output from Example:
<html>
<head>
<title>PHP Strings</title>
</head>
<body>
<p>Hello PHP World! Once</p>
<p>Hello PHP World! Twice!!</p>
<p>Hello PHP World! Thrice!!!</p>
<p>Hello PHP World! Infinity Times!!! ...</p>
</body>
</html>
Introduction: Parts of the Introduction were harder for me to read than the chapters that follow. I'd prefer a less demanding introduction.
Lightness: There is little humor in the book. Oh, well! The book is not heavy, but rarely is it light hearted.
Hey, PHP has it's lighter side. See PHP Fun in the left column.
Search Difficulty: I was uncertain what <?= meant? I looked it up in the index, but did not find it. :-( I looked around for it a tad more in the book and then tried unsuccessfully on the web. :-(
But this story has a happy ending. I eventually found an explanation of <?= in the book. :-)
As far as I recall, this was the only case where I had noticeable problems finding what I was looking for.
For: I would say the book would be best for someone who
Not For: Some reasons you might not want this book are:
Although much of the book is fairly easy to follow, it's not a good choice for someone looking for a tutorial. It's just not written to ease the reader along. For example, parts of the Introduction are more demanding than most of the detailed chapters. Generally the book is just too concentrated for a beginner.
If you are serious about PHP 4 and you need a reference, this is a well-organized, well written reference. Go for it.
While this reference manual is quite clearly written, I don't recommend it as a tutorial. I also don't recommend this book if you need something covering PHP 5; it doesn't address PHP 5.