note 114723 added to language.constants.predefined
| From: | php at kenman dot net | Date: | Fri, 28 Mar 2014 18:45:39 +0000 |
| Subject: | note 114723 added to language.constants.predefined | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199066@lists.php.net to get a copy of this message | ||
Just learned an interesting tidbit regarding __FILE__ and the newer __DIR__ with respect to code run
from a network share: the constants will return the *share* path when executed from the context of
the share.
Examples:
// normal context
// called as "php -f c:\test.php"
__DIR__ === 'c:\';
__FILE__ === 'c:\test.php';
// network share context
// called as "php -f \\computerName\c$\test.php"
__DIR__ === '\\computerName\c$';
__FILE__ === '\\computerName\c$\test.php';
NOTE: realpath('.') always seems to return an actual filesystem path regardless of the
execution context.
----
Server IP: 72.52.91.14
Probable Submitter: 74.112.244.13
----
Manual Page -- http://php.net/manual/en/language.constants.predefined.php
Edit -- https://master.php.net/note/edit/114723
Del: integrated -- https://master.php.net/note/delete/114723/integrated
Del: useless -- https://master.php.net/note/delete/114723/useless
Del: bad code -- https://master.php.net/note/delete/114723/bad+code
Del: spam -- https://master.php.net/note/delete/114723/spam
Del: non-english -- https://master.php.net/note/delete/114723/non-english
Del: in docs -- https://master.php.net/note/delete/114723/in+docs
Del: other reasons-- https://master.php.net/note/delete/114723
Reject -- https://master.php.net/note/reject/114723
Search -- https://master.php.net/manage/user-notes.php