how to go one folder back in __dir__ in php
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);
how to go one folder back in __dir__ in php
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);
how to go one folder back in __dir__ in php
dirname(__DIR__,level);
dirname(__DIR__,1);
how to go one folder back in __dir__ in php
// One level up
echo str_replace(realpath(dirname(__FILE__) . '/..'), '', realpath(dirname(__FILE__)));
// Two levels etc.
echo str_replace(realpath(dirname(__FILE__) . '/../..'), '', realpath(dirname(__FILE__)));
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us