PHP is a weak type language, if there are many variables in the program, plus PHP many function names are very confusing, chaos on the confusion, see also dazzling.
Unified coding style, and even variable naming, is very important in team development.
I engaged in the development of PHP for many years, in order to lead the team more effective, and gradually formed a kind of PHP naming habits (behind a friend said is already existing Hungarian nomenclature), so that their procedures appear very clear.
I will give you the experience below, not necessarily for others, but still share.
String, literal, plus str in front of variable
Copy PHP content to clipboard
PHP Code:
The following variable is a string type
$strMessage = ' Hello world! ';
arrays, array type, plus a in front of variable, one-dimensional array using noun singular, multidimensional array use Word plural
Copy PHP content to clipboard
PHP Code:
//下面一个变量为一维数组
$aData = array ( 1 , 2 , 3 , 4 , 5 ,6) ;
//下面一个变量为多维数组
$aMembers = array ( 'id' => 123456 , 'username' => 'ABC' , 'email' => 'abc#abc.com' ) ;
Integer, integral type variable, preceded by ' n '
Copy PHP content to clipboard
PHP Code:
The following variable is an integer
$nCount = $pBS->member->getcount ();
Boolean, preceded by ' B '
Copy PHP content to clipboard
PHP Code:
One of the following variables is Boolean
$bEncode = true;
float, float, plus ' f ' in front
Copy PHP content to clipboard