Use of aliases in the PHP namespace

Source: Internet
Author: User
Tags aliases

you can alias fields and table names in MYSQL such as:

1)SELECT a.username,a.order from orders as a

INNER JOIN user as B on a.username=b.username; -- alias the table

2) SELECT COUNT (goods_id) as totalgoods from Tdb_goods; -- alias the field

1) in the table alias, avoid two semantics, if on the following conditions changed to Username=username, obviously

will be error, of course, can also be changed to Order.username=uer.uername, but no alias to the simple.

From 2) We can see that the alias of the field can make the meaning clearer and improve the readability.

namespace identifiers can also be aliased in the PHP namespace, and the benefits and aliases in MYSQL are

The same.

As in the following example:

declaring namespaces Root\sub1 and root\sub2;



Operation Result:



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Use of aliases in the PHP namespace

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.