php operators and expressions

The functions of operators are divided into:

1. Operation operator + - * / % ++ --

Second, character operators. //Connection operator

3. Assignment operator = += -= *= /= %= .=

Fourth, the comparison operator> < >= <= == === != or <> !==

5. Logical operators && or and || or or ! or not

6. Bitwise operators & | ^ ~ << >> >>>

7. Other operators ?: '' @ => -> :: & $ 

Precautions:

1.% has two purposes: integer division operation; control range, do not use decimals, and do not use negative numbers

2.% will convert the numbers on both sides to integers and then divide them more closely

3.++ -- Usage

$a=10;
    $b= $a++; //b=10,a=11;
    $c = --$b;//c=9,b=9
    //  9  +  11
    $d=$c++ + ++$c;//d=20,c=11
    //  20 - 18
    $ e = $ d-- - - $ d; // e = 2
    echo $e;

4. === Not only requires the same content, but also the same type when comparing

5. Short circuit problem: && and || will short circuit

&& is doing the operation, if the previous number is false, then whether the latter is true, the regular expression is false, and the latter expression will not be executed

|| In the operation, if the previous number is true, then whether the latter is false, the regular expression is true, and the latter expression will not be executed.

& and | do not short-circuit

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325522523&siteId=291194637