PHP Learning Notes: Translating namespaces (namespace) learning materials

Source: Internet
Author: User

Name collisions means: You  create a function named Db_connect, and somebody elses code this you use the your file (i.e. An include) have the same function with the same name. To get around this problem, you rename your function stevewa_db_connect  

Name conflict means:

You create a function named Db_connect, and then you use a code that has the same function name as you (for example, an include). To solve the problem of function name conflict, you rename the original function named Db_connect to Stevewa_db_connect, which makes your name longer and harder to read.

Now you use the namespace namespaces to make sure that your function named Db_connect separate from the other function you're referencing, while you don't need an extra long prefix to resolve function name collisions. So, the namespace namespace is more like a file to the Pathfinder, but the file path you want to use is correct.

PHP Learning Notes: Translating namespaces (namespace) learning materials

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.