Deep PHP Specification Programming naming Summary _php instance

Source: Internet
Author: User

Before the work of the time did not pay attention to their own naming norms, now according to the hump name strict demands on themselves:

The relevant definitions are as follows

Basic Concepts
Camel-style nomenclature (also known as the Hump-naming method), as its name CamelCase indicates, refers to the combination of uppercase and lowercase letters to form variables and function names. Programmers are more likely to communicate with their peers for their own code, so take a more uniform, more readable naming style. For example: Some programmers like all lowercase, some programmers like to underline, so if you want to write a variable of my name, they will often be written in MyName, My_name, MyName, or myname. Such a naming convention is not suitable for all programmers to read, and the use of the camel-named method to express, can increase the readability of the program. For example, the following is the same function named after the camel-style nomenclature and the Underline method:
printemployeepaychecks ();
Print_employee_paychecks ();
The first function name uses the camel-named Method--each logical breakpoint in the function name is marked with an uppercase letter; the second function name uses an underscore----each logical breakpoint in the function name is marked with an underscore.
Camel-style nomenclature has become increasingly popular in recent years, and it is used quite a lot in environments such as many new functions libraries and Microsoft Windows. On the other hand, the underline method is popular after the advent of C, and in many old programs and UNIX environments, it is used very widely.

edit this paragraph application overview
Camel-style nomenclature (camel-case)is a set of naming rules (conventions) that are written by a computer program.
Camel-style nomenclature is when the variable name or function name is connected by one or more words,, the first word begins with a lowercase letter, and the initial letter of the second word or the first letter of each word is capitalized, for example: MyFirstName, Mylastname, Such variable names appear to be like camel peaks, hence the name.
Camel-style nomenclature (camel-case) comes from a commonly used case-mixed format in the Perl language, while the cover picture of the best-selling book "Programming Perl" (O ' Reilly published) by Larry Wall is just a camel.
The naming rules of camel-style nomenclature can be regarded as a convention and are not absolute or mandatory in order to increase recognition and readability.

Hump Method (Small Hump method)
The variable is usually identified by small hump method. The Hump method means that the first letter of a word is capitalized except for the first word. Such as
int mystudentcount;
Variable Mystudentcount The first word is all lowercase, followed by the first letter of the word uppercase.

Pascal method (Large Hump method)
In contrast to the small hump method, the big hump method capitalizes the first letter of a word. Commonly used for class names, function names, attributes, namespaces. Such as
Publicclass Databaseuser;

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.