3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php namespace { function CONSTANT() { return __NAMESPACE__; } $closure = function () { var_dump(CONSTANT()); }; $closure = $closure->bindTo(null, 'Foo\\Scope'); $closure(); $closure = $closure->bindTo(null, 'Bar\\Scope'); $closure(); } namespace Foo { function CONSTANT() { return __NAMESPACE__; } class Scope {} } namespace Bar { function CONSTANT() { return __NAMESPACE__; } class Scope {} }
Output for 5.3.0 - 5.4.30
Fatal error: Cannot redeclare CONSTANT() in /in/NUq13 on line 6
Process exited with code 255.