#28040 [Opn->WFx]: __DIR__ - Another 'magic constant'

From: Date: Sat, 17 Apr 2004 23:01:42 +0000
Subject: #28040 [Opn->WFx]: __DIR__ - Another 'magic constant'
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-58315@lists.php.net to get a copy of this message
ID: 28040 Updated by: derick@php.net Reported By: fb at fbeyer dot com -Status: Open +Status: Wont fix Bug Type: Feature/Change Request Operating System: * PHP Version: * New Comment: Just use dirname(__FILE__) if you need this information, we will not add this. regards, Derick Previous Comments: ------------------------------------------------------------------------ [2004-04-17 20:23:00] helly@php.net This would also ease writing test scripts. ------------------------------------------------------------------------ [2004-04-17 19:50:45] fb at fbeyer dot com Description: ------------ It would be extremely handy to extend the 'magic constant' family by __DIR__ - a constant poining to the directory where the current file is located, ending with a directory separator slash. __DIR__ could be defined in user-land by <?php // Defined as constant - so it won't be usable for // other files... define('__DIR__', dirname(__FILE__) . DIRECTORY_SEPARATOR); // Use __DIR__ require __DIR__ . 'another-file-for-this-library.php'; ?> Many scripts (e.g. SMARTY_DIR) already define variables/constants for this purpose. __DIR__ would be a nice feature to write include_path independent scripts. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28040&edit=1

« previous php.bugs (#58315) next »