3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php if (@__DIR__ == '__DIR__') { echo 'magic __DIR__ constant NOT defined' . PHP_EOL; define('__DIR__', substr(__FILE__, 0, strrpos(__FILE__, DIRECTORY_SEPARATOR))); } else { echo 'magic __DIR__ constant IS defined' . PHP_EOL; } var_dump(__DIR__);
Output for 5.3.0 - 7.1.0
magic __DIR__ constant IS defined string(3) "/in"
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.2.17
magic __DIR__ constant NOT defined string(3) "/in"
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
magic __DIR__ constant NOT definedPHP_EOLstring(3) "/in"