php - Downsides to using __DIR__

475

I recently came across the magic constant__DIR__ when resolving an issue regarding including scripts within included scripts.

After doing some reading I couldn't find any reason not to use__DIR__ to prefix every path in arequire orinclude statement.

So my questions is - are there any known downsides / potential side effects to be aware of when using__DIR__ . '/path/to/script.php' compared to using relative paths?

Thanks.

People are also looking for solutions to the problem: php - Using the resolve operator in the Symfony config env() helper

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.