Drill down into PHP's canonical programming naming summary _php instances

Source: Internet
Author: User
In the previous work did not pay attention to their own naming norms, now according to the hump name strict requirements for themselves:

The relevant definitions are as follows

Basic Concepts
Camel-like nomenclature (also called Hump nomenclature), as its name CamelCase implies, refers to the mixing of uppercase and lowercase letters to form the names of variables and functions. Programmers in order to their own code can be easier to communicate between peers, so more than a unified readability of the better way to name. For example: Some programmers like all lowercase, some programmers like to underline, so if you want to write a variable of my name, they often use the wording of myname, my_name, myname or myname. Such a naming convention is not suitable for all programmers to read, and the use of the Camel name method to express, can increase the readability of the program. For example, the following is the same function that is named with the camel-named method and the underscore method, respectively:
Printemployeepaychecks ();
Print_employee_paychecks ();
The first function name uses camel-named notation-each logical breakpoint in the function name is marked with an uppercase letter, and the second function name uses the underscore method----each logical breakpoint in the function name is marked with an underscore.
Camel-style nomenclature has become more and more popular in recent years, and it is used quite a lot in environments such as many new libraries and Microsoft Windows. On the other hand, the underscore is popular after the advent of C, in many of the old Programs and UNIX environment, it is very common use.

edit this paragraph application overview
Camel-style nomenclature (camel-case) is a set of naming conventions (conventions) when a computer program is written.
Camel-style nomenclature is when a variable name or function name is a unique identifier consisting of one or more words, the first word starts with a lowercase letter, the first letter of the second word is capitalized, or the first letter of each word is in uppercase letters, for example: MyFirstName, Mylastname, Such variable names look like camel peaks, so they get their name.
The term camel-named (camel-case) is a camel that comes from the widely used case-and-write format in Perl, and the cover picture of Programming Perl (O ' Reilly), a bestseller of Larry Wall.
The naming rules of camel-like nomenclature can be regarded as a convention, and there is no absolute and mandatory, in order to increase recognition and readability.

Hump Method (Small Hump method)
The variable is usually identified by the small hump method. The Hump method means that in addition to the first word, the first letter of the word is capitalized. Such as
int mystudentcount;
Variable Mystudentcount The first word is all lowercase and the first letter of the following word is capitalized.

Pascal method (Large Hump method)
Compared to the small hump method, the big hump method capitalized the first letter of the initial word. Commonly used for class names, function names, properties, 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.