Category Archive for PHP

Open Source Projects Status

I just released YALD 2.4.1 the other day. Mainly this release just added admin password hashing and improved database table indexing. For large directories, this should offer quite a performance increase.

My next big task is to clean up some of the code for PHP Deadlock (which noteable has not had a release in over a year and a half). In addition to cleaning up the code, I would like to add some features such as group support. Based on the traffic and attention it gets, I’m thinking it has much more potential the the link directory. Hopefully, I can start begin the task before summer is over. I have a couple other paid, non open-source projects that need to be finished up first.

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 »