I have been doing a lot of PHP development for my bachelor thesis over the last few months. We are working in a team of six and it is not always trivial to keep track of all the changes to the code, and debugging code you are not all that familiar with is a pain in the ass. I am coding in Netbeans 7.0 beta 2 with MAMP Pro 1.9 taking care of the server. To resolve my debugging issue I decided it was time I got Xdebug into the mix. It should also be noted that I’m using PHP 5.3, but I believe all of this should work just the same for 5.2 if you just replace the version number wherever it appears.
PHP vs. JavaScript
I love the rapid development of the technological wonder that is the Internet and its standards. The early nineties brought us static HTML pages which, but as time moved on more and more processing took place at the servers with a variety of server-side languages. However during the last few years much processing has been transferred to the browser using Javascript. This has meant that the majority of all browsers have gotten along for the ride and spent a lot of time speeding up the execution of these scripts. Out of curiosity I decided to compare the time it takes to perform a few standard actions in both JS and PHP.
Simple date validation
Date validation usually means regular expressions, and regular expressions usually means headache. All in all, I do think that PHP’s date handling is pretty sweet, but native validation is still lacking. With PHP 5.3 though, we are one step closer thanks to a new function with the infinitely long name date_parse_from_format. I’m going to show you how it can be used to create a validation function for any PHP date format.