1. Arithmetic Operators: +,-, *,/, and %.
2. Increment/decrease operators: for example, $ A ++, $ A --, ++ $ A, -- $.
For example:
<? PHP
$ A = 10;
$ B = 5;
$ C = $ A ++;// Assign values first and then auto-increment. $ C = $ A, $ A = $ A + 1
$ D = $ B --;// Assign values first and then subtract them from each other. $ D = $ B, $ B = $ A-1
Echo '$ A = '. $. "| ". '$ c = '. $ C. '<br/>'; // $ A = 11, $ c = 10
Echo '$ B = '. $ B. "| ". '$ d = '. $ D. '<br/>'; // $ B = 4, $ d = 5
?>
<? PHP
$ A = 10;
$ B = 5;
$ C = ++ $;// Auto-increment first and then assign a value. $ A = $ A + 1, $ c = $
$ D = -- $ B;// First subtract and then assign a value. $ B = $ A-1, $ d = $ B
Echo '$ A = '. $. "| ". '$ c = '. $ C. '<br/>'; // $ A = 11, $ c = 11
Echo '$ B = '. $ B. "| ". '$ d = '. $ D. '<br/>'; // $ B = 4, $ d = 4
?>
3. Comparison OPERATOR: Reference Document
4. logical operators:
For example:
$ A = 10; $ B = 7;
If ($ A ++> 8 | $ B ++> 7 ){// $ A ++> 8 is true. $ B ++> 7 is not executed.
Echo 'OK! ';
}
Echo 'a = '. $ A.' B = '. $ B;// Output OK, A = 11, B = 7
Change
$ A = 10; $ B = 7;
If ($ A ++> 10&&$ B ++> 7 ){//$ A ++> 8 is false. $ B ++> 7 is not executed.
Echo 'OK! ';
}
Echo 'a = '. $ A.' B = '. $ B;// A = 11, B = 7
Details:And & all represent logic and where are their differences?
Mainly reflected in priority
And priority And <= <&& Or <= <| For example:
$ A = false | true; // & >=> and;Compare false first | true, and then assign a value
$ B = false or true; // | |>=> or;First assign $ B = false and then compare, so the result is false.
Var_dump ($ A, $ B );//Bool (true) bool (false)