PHP has no use of this keyword solution

Source: Internet
Author: User
PHP has no use this keyword
Some of the PHP data I read seems to have no use. But just looking at a frame, I found that use was used.

------Solution--------------------
I guess not.
------Solution--------------------
That's not clear.
------Solution--------------------
namespace Foo;
Use My\full\classname as another;

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 (); Calls function My\full\nsname\subns\func
$a = new Arrayobject (Array (1)); Instantiates object of Class Arrayobject
Without the ' use arrayobject ' we would instantiate an object of class Foo\arrayobject
?>
It's like defining an alias 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.