Does PHP have the keyword "USE"? I have not read any PHP documents. But when I read a framework, I found that USE is used in it. ------ Solution -------------------- I guess not. ------ solution -------------------- I don't understand this ------ solution ---------------------- & lt ;? Does phpnamespacef php use this keyword?
Some PHP documents I have read do not seem to have been used. But when I read a framework, I found that USE is used in it.
------ Solution --------------------
I guess not.
------ Solution --------------------
This is not clear.
------ Solution --------------------
Namespace foo;
Use My \ Full \ Classname as Another;
// This is the same as use My \ Full \ NSname as NSname
Use My \ Full \ NSname;
// Importing a global class
Use ArrayObject;
$ Obj = new namespace \ Another; // instantiates object of class foo \ Another
$ Obj = new Another; // instantiates object of class My \ Full \ Classname
NSname \ subns \ func (); // callfunction My \ Full \ NSname \ subns \ func
$ A = new ArrayObject (array (1); // instantiates object of class ArrayObject
// Without the "use ArrayObject" we wocould instantiate an object of class foo \ ArrayObject
?>
It seems that an alias is defined for a class:
Use class3 as Another;
Use class3 as Another1;
Use class3 as Another2;
$ Obj = new Another ;//
$ Obj = new Another1 ;//
$ Obj = new Another2 ;//
------ Solution --------------------
Php 5.3 +