3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php namespace Foo\Bar\Baz; $closureBeforeDefined = function () { return A_RELATIVE_CONSTANT; }; define('A_RELATIVE_CONSTANT', 'IN GLOBAL NAMESPACE'); var_dump($closureBeforeDefined()); define('Foo\\Bar\\Baz\\A_RELATIVE_CONSTANT', 'IN RELATIVE NAMESPACE'); $closureAfterDefined = function () { return A_RELATIVE_CONSTANT; }; var_dump($closureBeforeDefined()); var_dump($closureAfterDefined()); var_dump(get_defined_constants());
based on 6loRa