<?php namespace Foo; /** * Documentation */ function bar() { } namespace Qux; use function Foo\bar; /* doc */ bar();
<?php namespace foo { function bar() { return __FUNCTION__; } } namespace { function bar() { return __FUNCTION__; } var_dump(bar()); use function foo\bar; var_dump(bar()); }
<?php namespace foo { function bar() { return __FUNCTION__; } } namespace { use function foo\bar; use function foo\bar; bar(); }
} namespace fizz; function baz() { return __FUNCTION__; } namespace baz; function bar() { return __FUNCTION__; } function baz() { return __FUNCTION__; } namespace test_simple; use function baz\bar; use function fizz\baz; var_dump(bar()); var_dump(baz()); namespace test_as; use function foo\bar as foobar; use function fizz\baz as fizzbaz; use function baz\baz as bazbaz; var_dump(foobar()); var_dump(fizzbaz()); var_dump(bazbaz());
<?php namespace { use function foo\bar as foo_bar; use function foo\bar2 as foo_bar2, foo\bar3 as foo_bar3, foo\bar4 as foo_bar4; use const foo\BAZ as FOO_BAZ0; use const foo\BAZ1 as FOO_BAZ_CONST1, foo\BAZ2 as FOO_BAZ_CONST2, foo\BAZ3 as FOO_BAZ_CONST3; use foo3\BAZ as FOO_BAZ1_CLASS; use foo2\BAZ as FOO_BAZ2_CLASS; var_dump(foo_bar()); var_dump(FOO_BAZ); }