In php, what are the special meanings of variables and functions whose names start with an underscore?

Source: Internet
Author: User
In php, what are the special meanings of variables and functions whose names start with an underscore? This is often seen in other people's frameworks, but what are the advantages of doing so? In php, what are the special meanings of variables and functions whose names start with an underscore?

This is often seen in other people's frameworks, but what are the advantages of doing so?

Reply content:

In php, what are the special meanings of variables and functions whose names start with an underscore?

This is often seen in other people's frameworks, but what are the advantages of doing so?

The framework starts the variable name and function name with _ to avoid conflicts with the user's name.

You can also start with _ to indicate private methods or attributes.

You can find:

Meanings of variables starting with an underscore in PHP

View PHP naming rules and development suggestions from "ThinkPHP development specifications"

An underline is a private variable and a private method.
The two underscores are built-in PHP variables.

It is a private member of the class.
This is just an unwritten rule. the benefit is enhanced readability. as soon as you see the name starting with the line below, it is a private member.

It should be from another language, suchC ++,Java.

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.