__DIR__ and dirname(__FILE__)

  • __DIR__ only exists with PHP >= 5.3
    • which is why dirname(__FILE__) is more widely used
  • __DIR__ is evaluated at compile-time, while dirname(__FILE__) means a function-call and is evaluated at execution-time
    • so, __DIR__ is (or, should be) faster.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: