3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php if (@__DIR__ == '__DIR__') { echo "magic __DIR__ constant NOT defined\r\n"; echo "defining __DIR__ constant\r\n"; define('__DIR__', substr(__FILE__, 0, strrpos(__FILE__, DIRECTORY_SEPARATOR))); } else { echo "magic __DIR__ constant IS defined\r\n"; } echo "\r\nresult of var_dump(__DIR__):\r\n"; 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 IS defined result of var_dump(__DIR__): string(3) "/in"
Output for 4.3.0 - 5.2.17
magic __DIR__ constant NOT defined defining __DIR__ constant result of var_dump(__DIR__): string(3) "/in"