When code is always written the way that it's written, it sometimes takes an outsider voice to question the rote.
Today I present to you a PHP puzzler that in fact had me stumped for a day or two. I do enjoy when a language throws a curve ball; it presents an opportunity to gain insight on the mechanics and become acquainted with the nuances of the language in question.… Read the rest
Inspired by a thread on Facebook to which I contributed, a few words concerning readable code vs compact code.
When writing applications, a common scenario involves setting a variable from some external source. What immediately ensues is a check to ensure that our variable has some meaningful value.… Read the rest
One of PHP’s less known language constructs is list(), very useful for unpacking indexed arrays. Consider the following simple example denoting its usage:
This clean, readable, scalable approach is great for processing data records, unpacking an SQL result row, etc. The only shortcoming, list() cannot be applied to an associative array.… Read the rest