- var_dump: documentation ( source)
- dirname: documentation ( source)
- debug_backtrace: documentation ( source)
- define: documentation ( source)
<?php
if (!defined('__DIR__')) {
class __FILE_CLASS__ {
function __toString() {
$X = debug_backtrace();
return dirname($X[1]['file']);
}
}
define('__DIR__', new __FILE_CLASS__);
}
var_dump(__DIR__);