Re: RFE to allow dirname($foo, 2)
| From: | Dennis Birkholz | Date: | Sat, 25 Jul 2015 18:11:48 +0000 |
| Subject: | Re: RFE to allow dirname($foo, 2) | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-87293@lists.php.net to get a copy of this message | ||
Hi,
Am 25.07.2015 um 19:42 schrieb Scott Arciszewski:
> On Sat, Jul 25, 2015 at 10:11 AM, Dennis Birkholz <dennis@birkholz.biz> wrote:
>> Hi,
>>
>> Am 23.07.2015 um 11:54 schrieb Josh Di Fabio:
>>> Now, most often, dirname(... dirname(__DIR__) ...) is used in application entry
>>> points during the bootstrapping process. In my experience, it's most commonly
>>> used in order to include an autoloader or some bootstrap file which itself is
>>> responsible for including the autoloader.
>>
>> doesn't work __DIR__.'/../../' on Windows also? Why do you need
>> dirname() here?
>
> What's easier to read and less likely to result in bugs?
>
> require_once __DIR__ . '/../../../../autoload.php';
> or
> require_once dirname(__FILE__, 5) . '/autoload.php';
I am not going to discuss personal preferences, but for me the first is.
You require to go four Levels up and include something, that should just
not be necessary with proper autoloading.
Greets,
Dennis