News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHP 10.0 Blog:
dirname(__FILE__)
March 22, 2007 @ 07:42:00

On the PHP 10.0 Blog today, Stas has a suggestion that might help out developers that use the combination "dirname(__FILE__)" to get the working directory. He proposes something like __FILEDIR__ to replace it and to help make code cleaner.

The reason is simple - libraries want to include files relative to library top directory, and do not want to count on include path. And relative include resolution rules in PHP not clear to all, so people prefer to be sure. The downside here is that this expression is dynamic - executed at run-time. Meaning it's slower and less toolable and also makes a bad habit of putting dynamic things into include (which is not a problem here, since it's "static dynamic" thing, but still a bad habit).

His suggestion has merit, and, according to the comments on the post, the reception seems like it would be positive.

2 comments voice your opinion now!
dirname proposal filedir library path application dirname proposal filedir library path application


blog comments powered by Disqus

Similar Posts

Paul Jones\' Blog: Solar 0.15.1 alpha released

ProDevTips: Writing a CMS/Community with Smarty and the Zend Framework: Part 8

PHP-GTK Community Site: Click Fast, Desktop Gadget & visualProxy

Sameer Borate's Blog: Google Translation PHP wrapper v1.7

NETTUTS.com: How to Create A Simple Web-based Chat Application


Community Events





Don't see your event here?
Let us know!


version community introduction library language symfony tool security framework laravel composer opinion interview podcast series list artisanfiles conference voicesoftheelephpant release

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework