Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the naming rules of legal names in php

Shulou Source: shulou.com Published: 2022-06-03 10:51:02 10月01日 Update

This article mainly introduces what are the naming rules of legal names in php. What is introduced in the article is very detailed and has a certain reference value. Friends who are interested must read it!

Naming rules for legal names in php: the first letter of the first word of the method name should be lowercase, and the first letter of the subsequent word should be capitalized. The first character of the parameter name in the method is lowercase, and all subsequent characters are capitalized according to the class naming convention.

This article operating environment: windows10 system, php 7, thinkpad T480 computer.

In PHP, the function of a method is to perform an action to achieve a goal, so the name should indicate what the method does.

The prefixes of general method names have the first rule, such as is (judge), get (get), set (setting) and so on.

Method naming rules:

The first letter of the first word is lowercase and the first letter of the subsequent word is capitalized.

For example:

Class StartStudy {/ / set class $mLessonOne = ""; / / set class property $mLessonTwo = ""; / / set class property function getLessonOne () {/ / define method to get the value of property mLessonOne.}}

The naming rules for the parameters in the

The first character uses lowercase letters. All characters after the first character are capitalized according to the class naming convention.

For example:

Class EchoAnyWord {function echoWord ($firstWord,$secondWord) {...}} these are all the contents of this article entitled "what are the naming rules of legal names in php". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Method rule letter word character lowercase Chinese legal name uppercase attribute initials content parameter name article value function interest prefix action Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Apple Shulou Technology NVidia Docker