2 comments | Posted: 6 August 06 in Books, by Robert Evans
I don’t really talk much about PHP these days because I do most all of my development work in either Ruby or Ruby on Rails. There are those occasional jobs that I take on where an existing application or site has been written in PHP and I’m hired to make alterations or enhancements. So, because of such occasions, and because I do like to keep up with what is going on, I tend to read a book here or there on PHP. PHP PhraseBook is one such book.
First off, I really like the concept of a Phrasebook. You know what I mean, those books you see on languages like Greek or German that give you phrases you can say to get around when you are in another country that speaks another language? This book is somewhat similar to those, yet it covers a programming language.
The PHP Phrasebook packs 9 chapters of small tutorials on how to use numerous types of features that are within the PHP language, covering up to PHP 5. To get a feel of what you can expect, here is a list of topics covered in those 9 chapters:
- Manipulating Strings
- Working with Arrays
- Date and Time
- Interacting with Web Forms
- Remembering Users (Cookies and Sessions)
- Using Files on the Server File System
- Making Data Dynamic
- Using XML
- Communicating with Others
At first glance, those who are familiar with PHP might think this book is not for them. Perhaps, if you know all the features and functions you don’t need this book. But, if you are like me and you tend to pickup one of your reference books to take a look at something you haven’t done in quite some time to make sure you’ve done it correctly, this book could be for you.
We all – least last I checked – hate spam. If you didn’t like it when your mom served it, you are definitely not going to like this new spam. It’s widely understood that if you put an email link on your site, eventually you are going to get spam. This book offers an interesting solution so you can keep your email link and they can keep their spam. The author, Christian Wenz, takes you through a tutorial on protecting your email address using ASCII codes. He shows to how to manipulate your email address string and convert it ASCII codes by running it through a for loop.
Something I didn’t know about and thought was quite cool was the sunrise and sunset functions provided in PHP 5. Taking a timestamp and the longitude and latitude positions and running them in the either of those functions will return either the sunrise or sunset for you location. A possible way to use this, in say a blog, would be to grab the users IP address do a Reverse DNS lookup and some coding magic to grab the longitude/latitude to provide a night and day version of your web site. You could do that provide an easy to read site for your readers.
Another interesting aspect that is covered is using the DOM in PHP 5 to read XML. There are several pages of examples to either refresh your memory or to learn something new. The libxml2 file is now bundled with PHP and the API has drastically been changed. So, I’ve found that having a reference on this showing examples of how to use it practically, is a great resource.
All in all, this is a good book for those who aren’t interested in a book that seeks to teach you PHP, but rather provide useful code examples to either refresh your memory or teach you something new. It assumes you do know PHP, albeit, you could be fairly new to PHP and still find this easy to understand. When PHP 5 is being covered the book usually makes note of this so that the reader is aware. This is a great little book, the size of a 3×5 card, that you can carry around for reference. I’d only wish more cool little tidbits were covered, but for almost 300 pages, it does cover a good amount.
Discuss This Topic
Comments closed after 2 weeks.