This is one of those rare books that I just couldn’t get enough of. Without a doubt a great buy.
Wicked Cool PHP scripts does not teach you to program in PHP. It assumes that you already understand the basics of programming and the PHP language, if not then Learning PHP 5 from O’Reilly would be a good starting point. Once you have learnt the basics of programming this book takes you through some really useful examples of how to apply PHP in the real world. These examples are not just for relatively new programmers, but there is something to get more experienced programmers thinking.
One case in point is the use of regular expressions. I consider myself pretty familiar with regular expressions having used them for several years. I’ve even written a regular expression tutorial (not PHP specific – more Perl related), but I found the different approach used in Wicked Cool PHP made me think about different ways in which regular expressions could be solved. Again if you don’t understand regular expressions it doesn’t give enough information to get started for help learning regular expressions), but it does help you to apply them in different ways.
Each script has a good explanation alongside the sample code making it easy to how it works. A good feature is that most have a paragraph on “What can go wrong?” which explains some of the potential issues and how to avoid them.
Scripts are provided on a variety of different topics including security, form validation, manipulating text and dates, handling files, session tracking, emails and image handling. There is a CAPTCHA image (Turing test to prevent robots submitting content) example which is quite simple but can be very useful.
I do have one issue with the book which is an example of how to validate North American phone numbers. The code is okay for those in the USA, but considering the world wide web is a global medium this can cause issues with international visitors. I have had to use a site that used a check and as a result have had to enter an invalid phone number as there was no way of entering a UK phone. The very least this should have had a warning or a “What can go wrong” section to make readers aware of this.
This is a really useful book for anyone that has already mastered the basics of PHP and wants to get some example scripts and a few ideas of how apply PHP programming in a web environment.