Archive for July, 2010

An introduction to PHP’s static scoping

Thursday, July 29th, 2010

The static keyword is a core feature of PHP’s object oriented programming. Unfortunately, there doesn’t seem to be much in the way of easy introductions available online, so I’d like to give a brief overview of how the keyword functions, and how it should be used.

PHP actually has two distinct uses for the static keyword. The first and most common usage is related class method and property scoping, the second to variable scoping within in a single function. (more…)

Includes are not functions

Wednesday, July 28th, 2010

Over the last week I’ve been working with a commercial PHP eCommerce package. Amongst some shockingly bad code one of the patterns that has stood out has been the use of includes a kind of pseudo-function. Dozens of files in the application are in the following format. (more…)

Dynamically define subdomains with Apache

Tuesday, July 13th, 2010

When I need to develop multiple sites at once I often find defining multiple Apache Vhosts and host files entries to be time consuming. Thankfully, with a little Apache magic it’s possible to automatically create a new subdomain for each project I start. (more…)