What is the name of the hump in PHP?

Source: Internet
Author: User
Hump namingThe law is that when a variable name or function name is a unique identifier consisting of one or more words, the first word begins with a lowercase letter; Hump namingThe first letter of the second word or the initials of each word are capitalized, for example: MyFirstName, mylastname, such variable names look like Camel peaks, so the name Hump naming

Programmers in order to their own code can be easier to communicate between peers, so more than the unified readability of a 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.

The term Hump nomenclature (camel-case) comes from a common case-and-write format used in the Perl language, and the cover picture of Programming Perl (O ' Reilly, published by Larry Wall and others) is a camel.

The naming rules of hump nomenclature can be regarded as a convention, and there is no absolute and mandatory, in order to increase the recognition and readability.

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.

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;

So when working should pay attention to their own naming norms, according to the hump name strict requirements of their own!

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.