PHP Phrasebook

2 comments | Posted: 6 August 06 in Books, by Robert Evans

PHP Phrasebook 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:

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

  1. 1 Mark Taber

    Thanks for the nice review. As an editor who worked on the book—and the Phrasebook series as a whole—I’m very glad that you and others picked up on the concept quite quickly and found it useful in your work.

    We’re right now in the process of trying to figure out how to expand the books beyond their 300 or so printed pages and provide even more of the cool little tidbits you were wishing for. So I’d be interested in getting feedback from readers about the best way to accomplish this. In particular, whether or not you think the material in these books would be equally convenient and accessible if it were online at a web site or perhaps even downloadable as a PDF—or if an important part of the appeal is the convenience of having it in a small printed book. Thanks again!

  2. 2 Robert

    Hi Mark, glad you stopped by. I personally like the small book idea, but I also think adding a PDF version would be really awesome. I know several other publishing companies do the PDF thing and it is working quite well for them.

    What really appealed to me was the size of the book – easy to carry around with me. Have the same size with another 100 pages wouldn’t make a difference to me in the terms of being bigger. I’d appreciate the “more bang for my buck” as well.

    I’m glad you stopped by and I am looking forward to checking out the Ruby Phrasebook when it comes out!


Comments closed after 2 weeks.