Req #28040 [Com]: __DIR__ - Another 'magic constant'

From: Date: Thu, 04 Mar 2010 17:04:19 +0000
Subject: Req #28040 [Com]: __DIR__ - Another 'magic constant'
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-148256@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=28040&edit=1

 ID:               28040
 Comment by:       
 Reported by:      fb at fbeyer dot com
 Summary:          __DIR__ - Another 'magic constant'
 Status:           Wont fix
 Type:             Feature/Change Request
 Package:          Feature/Change Request
 Operating System: *
 PHP Version:      *

 New Comment:

"we will not add this"

http://php.net/manual/en/language.constants.predefined.php

:)


Previous Comments:
------------------------------------------------------------------------
[2004-04-18 01:01:41] derick@php.net

Just use dirname(__FILE__) if you need this information, we will not add
this.

regards,
Derick

------------------------------------------------------------------------
[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/bug.php?id=28040&edit=1


Thread (4 messages)

« previous php.bugs (#148256) next »