php how to go one level up on dirname(__FILE__)

The Solution to php how to go one level up on dirname(__FILE__) is


For PHP < 5.3 use:

$upOne = realpath(dirname(__FILE__) . '/..');

In PHP 5.3 to 5.6 use:

$upOne = realpath(__DIR__ . '/..');

In PHP >= 7.0 use:

$upOne = dirname(__DIR__, 1);

~ Answered on 2012-06-19 05:22:01


Most Viewed Questions: