Before the discussion is only PHP data type, so-called "sharpening does not mistake chopping wood work", Lay a good PHP foundation to better learn PHP programming.
There is little difference between the expression and the operator in PHP and the C language, which is now listed below:
┌─────┬─────────┬──────────┐
│ Symbols │ Operators │ Examples │
├─────┼─────────┼──────────┤
│+│ addition │ $a + $b │
├─────┼─────────┼──────────┤
│-│ Subtraction │ $a-$b │
├─────┼─────────┼──────────┤
│*│ multiplication │ $a * $b │
├─────┼─────────┼──────────┤
│/│ Division │ $a/$b │
├─────┼─────────┼──────────┤
│%│ remainder │ $a% $b │
├─────┼─────────┼──────────┤
│++│ Increment │ $a + + or + + $a │
├─────┼─────────┼──────────┤
│--│ Decrease │ $a--or--$a │
├─────┼─────────┼──────────┤
│==│ equals │ $a ==10│
├─────┼─────────┼──────────┤
│===│ is absolutely equal to │ $a ===10│
├─────┼─────────┼──────────┤
│!=│ not equal to │ $a!=10│
├─────┼─────────┼──────────┤
│<│ less than │ $a <9│
├─────┼─────────┼──────────┤
│>│ greater than │ $a >8│
├─────┼─────────┼──────────┤
│<=│ less than or equal to │ $a <=10│
├─────┼─────────┼──────────┤
│>=│ greater than or equal to │ $a >=1│
├─────┼─────────┼──────────┤
│=│ equality assignment operator │ $a =0│
├─────┼─────────┼──────────┤
│+=│ addition specified operator │ $a +=5│
├─────┼─────────┼──────────┤
│-=│ subtraction specified operator │ $a-=1│
├─────┼─────────┼──────────┤
│*=│ multiplication specified operator │ $a *=2│
├─────┼─────────┼──────────┤
│/=│ division specified operator │ $a/=5│
├─────┼─────────┼──────────┤
│%=│ remainder specified operator │ $a%=7│
├─────┼─────────┼──────────┤
│.=│ string specifying operator │ $a. = "Hello" │
├─────┼─────────┼──────────┤
│&│ and │ $a & $b │
├─────┼─────────┼──────────┤
│| │ or │ $a | $b │
├─────┼─────────┼──────────┤
│^│xor│ $a ^ $b │
├─────┼─────────┼──────────┤
│~│ Non-│~ $a (take 1 of the complement) │
├─────┼─────────┼──────────┤
│<<│ shift left │ $a << $b │
├─────┼─────────┼──────────┤
│>>│ right Shift │ $a >> $b │
├─────┼─────────┼──────────┤
│and or &&│ with │ $a and $b or $a&& $b │
├─────┼─────────┼──────────┤
│or or | | │ or │ $a or $b or $a| | $b │
├─────┼─────────┼──────────┤
│xor│xor│ $a xor $b │
├─────┼─────────┼──────────┤
│! │ non-│! $a │
└─────┴─────────┴──────────┘
┌───┬────────────┐
│ Symbols │ Meaning │
├───┼────────────┤
│$│ variable │
├───┼────────────┤
Pointer to the │&│ variable (before the variable) │
├───┼────────────┤
│->│ methods or properties of an object │
├───┼────────────┤
│=>│ element values of an array │
├───┼────────────┤
│? : │ ternary operator │
└───┴────────────┘
Compare it with the C language. There's just one more "." This operator. Its role is to make two strings connected, as shown in the following example, the result is hello,my baby.
$a = "Hello,";
$b = "My Baby.";
echo $a. $b;
?>
There is also a symbol that makes PHP powerful. This is "$". It is used before a variable, indicating that it is a variable, such as $ A, $b, and so on. And where does it work? This Queensland unlimited is the variable of the variable.
The following example:
$a = "Go";
$ $a = "here";
echo $a;
echo $ $a;
Echo $go;
?>
The results shown are:
Go
Here
Here
In fact, adding a "$" before a variable means that the contents of the variable are used as a new variable name. This is unique to PHP, and sometimes simplifies the program.
http://www.bkjia.com/PHPjc/532533.html www.bkjia.com true http://www.bkjia.com/PHPjc/532533.html techarticle before the discussion is only PHP data type, so-called "sharpening does not mistake chopping wood work", Lay a good PHP foundation to better learn PHP programming. There is little difference between the expression and the operator in PHP and the C language ...