Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the naming methods of php

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what are the naming methods of php". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the naming methods of php"?

The three naming methods of php are: 1, small hump naming method, the first word begins with a lowercase letter, the first letter of the second word is capitalized or the first letter of each word is capitalized; 2, Pascal naming method (also known as big hump naming method); 3, Hungarian naming method, naming rule is "variable name = attribute + type + object description".

Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

Three naming methods of php

I. nomenclature of small humps:

Small hump method (camel method) variables are generally identified by small hump method.

The first word begins with a lowercase letter

The first letter of the second word is capitalized or the first letter of each word is capitalized.

For example: myFirstName, myLastName

2. Pascal nomenclature (big hump nomenclature):

Large hump method (Upper Camel Case) is also known as Pascal nomenclature: (pascal method) is often used for class names, function names, attributes, and namespaces.

Compared with the small hump method, the big hump method capitalizes the first letter of the first word. For example: public class DataBaseUser

Here is the same function named with camel naming and underscore respectively:

PrintEmployeePaychecks (); camel naming-every logical breakpoint in a function name is marked with an uppercase letter

Print_employee_paychecks (); underscore method-each logical breakpoint in the function name is marked with an underscore.

III. Hungarian nomenclature:

The basic principle is: variable name = attribute + type + object description.

The key to Hungarian naming is that the name of the identifier begins with one or more lowercase letters as a prefix; the prefix is followed by an uppercase word or combinations of words that indicate the purpose of the variable.

Hungarian nomenclature identifies the scope and type of the variable by prefixing it with the symbol identification of the corresponding lowercase letters in front of the variable name. These symbols can be used at the same time, the order is first m _ (member variable), then pointer, then simple data type, and then other.

For example: m_lpszStr represents a long pointer member variable that points to a string that ends with a 0 character.

The prefix of lowercase letters commonly used in Hungarian nomenclature:

Prefix type

Array a (Array)

B Boolean value (Boolean)

By bytes (Byte)

C signed character (Char)

Cb unsigned characters (Char Byte, not used by many people)

Cr color reference value (ColorRef)

Cx,cy coordinate difference (length ShortInt)

Dw Double Word

Fn function

H Handle (handle)

I integer

L long integer (Long Int)

Lp Long Pointer

Members of the m _ class

N short integer (Short Int)

Np Near Pointer

P Pointer

S string type

String type of sz ending with null (String with Zero End)

W Word

Thank you for your reading, these are the contents of "what are the naming methods of php". After the study of this article, I believe you have a deeper understanding of what the naming methods of php have, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report