How to learn PHP for beginners
This article mainly explains "how beginners learn PHP". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how beginners learn PHP.
1. Embedding method:
Similar to ASP
4. Variable type:
The copy code is as follows:
$mystring = "I am a string"
$NewLine = "new line"
$int1 = 38
$float1 = 1.732
$float2 = 1.4E+2
$MyArray1 = array ("son", "ugly", "Yin", "Mao")
This leads to two questions. First, the PHP variable starts with $, and the second PHP statement ends with;, which may not be suitable for ASP programmers. These two omissions are also where most of the program errors lie.
5. Operation symbol:
Mathematical operations: symbolic meaning
+ addition operation
-subtraction operation
* multiplication operation
/ division operation
% remainder
+ + accumulate
-- decreasing
String operation:
There is only one operational symbol, which is the full stop in English. It can concatenate strings into a new merged string. Similar to & in ASP
Program code
The copy code is as follows:
This also leads to two questions. First, the output statement in PHP is echo, the second is similar to that in ASP, and it can also be used in PHP.
What's particularly important here is that judging whether equality is = rather than =, which is a common mistake made by ASP programmers, = is an assignment.
Example: the executive part of this example has three lines, and the curly braces cannot be omitted.
Program code
The copy code is as follows: