file1.php:
namespace Foobarsubnamespace;
Const FOO = 1;
function foo () {}
Class foo{
static function Staticmethod () {}
}
?>
file2.php:
namespace FooBar;
Include ' file1.php ';
Const FOO = 2;
function foo () {}
Class foo{
static function Staticmethod () {}
}
Unqualified name
Foo (); resolves to foo\bar\foo resolves to function foo\bar\foo
Foo::staticmethod (); A static method staticmethod that resolves to a class foo\bar\foo. resolves to class Foo\bar\foo, method Staticmethod
Echo FOO; resolves to constant foo\bar\foo
Qualified name
Subnamespace\foo (); Parse to function Foo\bar\subnamespace\foo
Subnamespace\foo::staticmethod (); resolves to class Foo\bar\subnamespace\foo, and methods of classes Staticmethod
Echo Subnamespace\foo; Resolve to constant Foo\bar\subnamespace\foo
Fully qualified name
\foo\bar\foo (); Parse to function Foo\bar\foo
\foo\bar\foo::staticmethod (); resolves to class Foo\bar\foo, and methods of classes Staticmethod
Echo \foo\bar\foo; Resolve to constant Foo\bar\foo
?>
Reply content:
file1.php:
namespace Foobarsubnamespace;
Const FOO = 1;
function foo () {}
Class foo{
static function Staticmethod () {}
}
?>
file2.php:
namespace FooBar;
Include ' file1.php ';
Const FOO = 2;
function foo () {}
Class foo{
static function Staticmethod () {}
}
Unqualified name
Foo (); resolves to foo\bar\foo resolves to function foo\bar\foo
Foo::staticmethod (); A static method staticmethod that resolves to a class foo\bar\foo. resolves to class Foo\bar\foo, method Staticmethod
Echo FOO; resolves to constant foo\bar\foo
Qualified name
Subnamespace\foo (); Parse to function Foo\bar\subnamespace\foo
Subnamespace\foo::staticmethod (); resolves to class Foo\bar\subnamespace\foo, and methods of classes Staticmethod
Echo Subnamespace\foo; Resolve to constant Foo\bar\subnamespace\foo
Fully qualified name
\foo\bar\foo (); Parse to function Foo\bar\foo
\foo\bar\foo::staticmethod (); resolves to class Foo\bar\foo, and methods of classes Staticmethod
Echo \foo\bar\foo; Resolve to constant Foo\bar\foo
?>