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 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
magic __DIR__ constant NOT defined string(3) "/in"
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.2.17
magic __DIR__ constant IS defined Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /in/XAa0N on line 9 string(7) "__DIR__"
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/XAa0N on line 7 magic __DIR__ constant IS definedPHP_EOL Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /in/XAa0N on line 9 string(7) "__DIR__"