Magic constant not working with require_once

Its funny when a new feature is added to your language of choice how quickly it gets embraced and used within your code. Today upon uploading some code to a clients shared hosting environment I was greeted by the following error:

Uploading a file to display phpinfo() I was able to ascertain the server was running PHP 5.2.17. But after a bit of searching I found the __DIR__ magic constant was not added to PHP until 5.3.

Ends up if your code is going to run on older installs the best solution is to replace __DIR__ with dirname(__FILE__) this provides the same functionality as using the __DIR__ magic constant but works with versions of PHP from 4.0.2.