Their result is exactly the same ; 所以,在这一点上没有区别.
例如,以下两行:
var_dump(dirname(__FILE__));
var_dump(__DIR__);
将提供相同的输出:
string '/home/squale/developpement/tests/temp' (length=37)
__DIR__
only exists with PHP >= 5.3
作为参考,请参阅手册(quoting)的Magic constants部分:
__DIR__
:文件的目录.