22nd February 2008

Posted in

Blog :: It's Magic

Via phpdeveloper.org I saw this little blog post which notes that in an upcoming PHP 5.3 release a new constant '__DIR__' will be defined. Pretty obviously this is the directory equivalent of "__FILE__".

I know this doesn't seem like much of a feature but it actually makes me happy - a lot of my one-off PHP scripts start with:

define("__DIR__", dirname(__FILE__));

since I'm likely doing things like loading files from or looping over a relative directory... Not earthshaking, but does nicely reflect PHP's pragmatic impulses.

Posted on February 22nd 2008, 03:11 PM