Tag Archive for PHP

Zend PHP5 Certified

I decided to have a go at the Zend PHP5 certification test a few weeks ago even though I don’t believe in this type of test. After all, testing you on whether or not you know exactly what the strtr() function does isn’t going to gauge how good of a programmer you are. In the real world, you’re going to have the PHP manual and Google at your fingertips. Of course having the certification can’t hurt on a resume.

I purchased the test on line for $125 along with 5 practice tests that costed a little extra and was able to schedule for the next day. Practice test #1 I failed, but I managed to pass all the subsequent tests. Yes, the practice tests helped.. they were very similar to the actual test.

My advice: If you’re planning on taking the Zend certification test, be sure you know your OOP syntax, function arguments and XML parsers. Since I don’t use OOP or XML too often, I had to brush up on those.

Overall, the test certainly wasn’t as easy as I thought and I didn’t feel that I did that well. Unfortunately, or fortunately rather, Zend doesn’t allow you to know your score. Regardless, despite my bad feeling, I managed to pass, so now I’m Zend certified. I am still awaiting the arrival of my certificate.

Parsing a United States Location String with PHP

So I needed a way to parse/extract a location string into the city and state or zip code for a client’s site. If you don’t quite know what I’m talking about, head over to Superpages and look at the location field. A couple Google searches later, I decided to just go ahead an write my own function. This sounds easy until you think about it. Any of the following inputs need to be able to be parsed.

  1. dallas tx
  2. dallas, texas
  3. los angeles california
  4. washington disctrict of columbia
  5. richmond virginia
  6. charleston west virginia
  7. 90001

This is beyond the scope of a simple regular expression. We can’t simply use the last word of the input either since the state could be multiple words like in case #4. There’s no way to determine which word or group of words is the state without testing the string against an array of states. As you can see, cases like #5 and #6 complicate things even further because if we test from the end of the string, virginia could also be west virginia.

Here is the function I came up with. Please let me know if you find a bug or condition that cannot be parsed. Read the rest of this entry »