Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
only functions are separated with multiple namespaces in a file
<?php
namespace A {
$closure = function () {
echo __NAMESPACE__;
};
}
namespace B {
$closure = function () {
echo __NAMESPACE__;
};
$var = 'foo';
function foo()
{
return 'foofunc()';
}
}
namespace C {
use function B\foo;
$closure();
echo '<br>';
echo $var;
echo '<br>';
echo foo(); // only this require a use statement
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.