note 97935 added to function.defined
| From: | audvare at gmail dot com | Date: | Mon, 17 May 2010 02:35:05 +0000 |
| Subject: | note 97935 added to function.defined | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-169314@lists.php.net to get a copy of this message | ||
For compatibility with PHP 5.3 and 5.2 and dirname(__FILE__) vs __DIR__ constant:
<?php
$dir = NULL;
if (defined('__DIR__')) {
$dir = __DIR__;
}
else {
$dir = dirname(__FILE__);
}
?>
Not for every time; you should probably just define this elsewhere so every time the script needs
the current directory just use $dir which was taken from that bit.
----
Server IP: 69.147.83.197
Probable Submitter: 76.19.122.130
----
Manual Page -- http://www.php.net/manual/en/function.defined.php
Edit -- https://master.php.net/note/edit/97935
Del: integrated -- https://master.php.net/note/delete/97935/integrated
Del: useless -- https://master.php.net/note/delete/97935/useless
Del: bad code -- https://master.php.net/note/delete/97935/bad+code
Del: spam -- https://master.php.net/note/delete/97935/spam
Del: non-english -- https://master.php.net/note/delete/97935/non-english
Del: in docs -- https://master.php.net/note/delete/97935/in+docs
Del: other reasons-- https://master.php.net/note/delete/97935
Reject -- https://master.php.net/note/reject/97935
Search -- https://master.php.net/manage/user-notes.php