3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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__);
Output for 5.2.0 - 5.6.28, 7.0.0 - 7.1.0
string(3) "/in"
Output for hhvm-3.12.0
Warning: Constants may only evaluate to scalar values in /in/0rEnK on line 9 string(3) "/in"
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.0 - 5.1.6
Warning: Constants may only evaluate to scalar values in /in/0rEnK on line 9 Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /in/0rEnK on line 11 string(7) "__DIR__"