Environment has been set up, the following can be happy coding, variables in PHP or more, the following describes some of the rules of naming PHP variables:
1, all variable names must begin with a dollar sign ($)
2, the first character after the dollar sign must be a letter (a~z,a~z) or an underscore (_), you cannot use a number
3, the remaining part of the variable name can contain any number of hungry letters, numbers and underscores of the combination
4, there is no space in the variable name (usually with an underscore for text splitting)
5, variable names must be unique
6, variable names are case-sensitive! , which means that $varible and $varible are completely different two variables, so it is very irrational to name two variables so similar.
There are also some suggestions to reduce the bug caused by the name of the variable.
1, variable names all use lowercase letters
2, let the variable name is descriptive, as far as possible to see its name to know its meaning
3, use annotations to illustrate the purpose of the variable
4, most importantly, to maintain a consistent variable name
The variable is over, let's study, the difference between double and single quotes, double quotation marks and single quotation marks the biggest difference is that the contents of the double quotation marks can be replaced, and the contents of the single quotation mark cannot be replaced,
The code is as follows:
The results of the operation are as follows:
You can see that the result of ¥RESULT1 is $string character, not the content of this variable, ¥RESULT2 content is $string content.
It may be thought that these things are very simple, but also easy to remember, but as a coder, small knowledge points, small programs sometimes to you learn a language has a team very much encouragement to promote the role OH