How can one ensure compatibility with different PHP versions when using dirname(__FILE__) instead of __DIR__?

When using `dirname(__FILE__)` instead of `__DIR__`, it is important to ensure compatibility with different PHP versions by adding a fallback for older versions that do not support `__DIR__`. This can be done by defining `__DIR__` if it is not already set using `defined('DIR') ? DIR : dirname(__FILE__)`.

if (!defined('__DIR__')) {
    define('__DIR__', dirname(__FILE__));
}