In PHP, what would be the cleanest way to get the parent directory of the current running script relative to the www root? Assume I have:
$_
As of PHP 5.3.0 you can use __DIR__ for this purpose.
The directory of the file. If used inside an include, the directory of the included file is returned. This is equivalent to dirname(__ FILE__).
See PHP Magic constants.
C:\www>php --version
PHP 5.5.6 (cli) (built: Nov 12 2013 11:33:44)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
C:\www>php -r "echo __DIR__;"
C:\www