Home
Archives
About us...
Advertising
Contacts
Site Map
 

ruby in steel

 

Book Reviews:
Spring Into PHP 5
by Steven Holzner
Teach Yourself PHP in 10 Minutes
by Chris Newman


July 2005 (review updated: March 2006)

PHP has become one if the most important Internet programming languages. It is used to create everything from discussion forums and blogs to online shopping carts. In spite of its enormous success, I am remarkably ignorant of the language. This may be due to the fact that PHP seems to have snuck up onto the Web rather than being launched onto it with blaring fanfares and drums as Java was. All the more curious then that PHP is now widely used as a general purpose programming language for complex Web applications whereas Java has increasingly become a ‘niche’ language.

PHP started life as a ‘Personal Home Page’ language. These days however, the letters are supposed to form a recursive acronym (very trendy among serious coders!) meaning ‘PHP: Hypertext Processor’.

PHP is a new type of language to me. By that, I don’t mean that its syntax is hugely different from other languages with which I am familiar. Overall, PHP code looks like a sort of simplified C with maybe a bit of Pascal thrown in for good measure.

But unlike other languages, you don’t just write PHP then compile and run it. Instead, you embed PHP code into the HTML of a web page. This code is processed on the server and replaced with HTML. So when you view the source of a PHP page (normally a web page with the extension ‘.php’) on the web, you won’t actually see any PHP code!

While you can learn to write PHP by placing your files onto a web host which supports PHP, I decided that it would be a good deal more convenient to install a web server (I chose Apache http://httpd.apache.org/download.cgi) and the PHP binaries and tools on my local PC (http://www.php.net/downloads.php). I then began to work my way through the two books below in an attempt to learn the basics of PHP. This month I’ll give you my first impressions of these two books. I’ll return to give my further comments at a later stage after I’ve made more progress in my studies….

Spring Into PHP 5
by Steven Holzner
Addison-Wesley http://www.awprofessional.com/springinto/
ISBN: 0-13-149862-2
US $29.99 / UK £21.99
You can buy this book at a discount from Computer Manuals (UK).

A nicely formatted book of just under 340 pages, this takes you from the basics of writing and running a very simple PHP script right through to more advances topics such as working with databases, setting cookies and storing session data. It claims to be aimed at ‘busy professionals’ and assumes no more knowledge than ‘familiarity with HTML’.

My first impressions are that it is a fairly approachable book - it simply looks nice and seems to be beginner-friendly without being condescending. The nine chapters are divided up into bite-sized sections with plenty of screenshots, code fragments and boxed-out notes.

I have to say I am not too impressed with the PHP installation instructions, however. In essence, it just tells you to install some web server software, install PHP and then figure the rest out for yourself. In my experience, figuring it out means wading through pages of incredibly verbose (but not always particularly clear) instructions on the PHP web site (http://www.php.net).

The book gives a decent account of the essential features of PHP - its syntax, operators, functions and so on. There are plenty of small examples but no ‘big projects’. The source code can be downloaded from the publisher’s site.

Overall, this looks like a competent beginners’ book on PHP.

Teach Yourself PHP In 10 Minutes
by Chris Newman
Sams http://www.samspublishing.com
ISBN: 0-672-32762-7
US $14.99 / UK £10.99
You can buy this book at a discount from Computer Manuals (UK).

If this book lived up to its title, I would have mastered PHP in less time than it’s taking me to write this review! In fact, the ‘ten minutes’ claim refers to each individual lesson rather than to the entire book and, frankly, you’d have to be a fairly fast learner even to master some of those that quickly.

This is a smaller book than ‘Spring Into PHP 5’. Not only does it have fewer pages (254 including the index) but its physical dimensions are also smaller at about the size of a slim paperback novel. Initially, I was prejudiced against the book due to its rather silly title so I left off reading it until after I’d already installed and run PHP. In retrospect this was a mistake. Unlike ‘Spring Into PHP’, this book has simple, straightforward installation instructions (albeit hidden away in an appendix) which could have saved me the frustration of picking my way through the over-complicated instructions on the PHP site.

The book is divided up into themed sections - PHP Foundations, Working With Data, The Web Environment, Using Other Services From PHP and Configuring and Extending PHP. These sections are further divide into individual lessons. For example, the Working With Data section contains lessons on Working with Strings, Working With Arrays, Regular Expressions and more.

As with ‘Spring Into PHP’, there are lots of code examples and handy notes but there are (curiously perhaps) no screenshots to show the results that you should expect to see on screen.


My initial impression is that ‘Teach Yourself PHP In 10 Minutes’ may be good to ‘dip into’ at odd moments, whereas ‘Spring Into PHP 5’ seems to assume that you will want to sit down and study it from start to finish. On the one hand, I prefer the ‘dip into’ approach; on the other hand, the ‘Spring Into’ book appears to go a little deeper into PHP than the ‘10 Minute’ book. That said, I’m not sure that either of them is really particularly well targeted. They cover a rang of fairly technical topics ranging from regular expressions to file handling and web servers, which might suggest that they are aimed at reasonably experienced programmers. And yet both books also explain really elementary concepts such as ‘what is a variable?’ which suggests they are aimed at total novices.

Ah well, at last they’ve got me started on the path to mastering PHP. I’ll let you know how I get on in a month or two…

July 2005


Update...

Having now had the chance to ‘live’ with both these books for a few months it’s time to update my initial impressions. First, I have to say that neither book is ideal for my personal requirements. I am very much the type of programmer who likes to start coding right away and refer back to the book only when I get stuck. I would, therefore, have been more impressed by these books if they had got me up and running with PHP – say, at least as far as writing a few functions in one file and displaying some results in a web page in a second file – within the first five or ten minutes. Instead, both books take a much more leisurely route into PHP coding, starting with a few simple snippets before moving onto a more in-depth look at PHP programming constructs – variables, loops, tests etc.

This reservation aside, the tutorials provided by both books are not bad. The shorter chapters and sections in PHP In 10 Minutes make this book slightly better for ‘dipping into’ than the Spring Into book. On the other hand, Spring Into goes into more depth and benefits from a handy quick-reference section towards the back. This includes a table of PHP keywords and summaries of topics such as Data Types, Predefined Variables and loop syntax. Neither book has quite as many PHP code snippets as I would have liked; and neither has any long samples to illustrate how to create a PHP application of moderate complexity.

To be honest, then, I can’t say that either book gets an unqualified thumbs up. However, due to its better reference section, what I can say is that I have tended to refer to Spring Into PHP rather more frequently than to PHP In 10 Minutes.

March 2006

Huw Collingbourne

 

 


Home | Archives | Contacts

Copyright © 2006 Dark Neon Ltd. :: not to be reproduced without permission