Does php use this keyword solution?

Source: Internet
Author: User
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 ., I guess not. I don't understand this. & lt ;? Phpnamespacefoo; useMy \ Full \ ClassnameasAnother; // Is there a keyword for using thisisthesameas PHP?
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 +

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.