1 // environment 2 // . 3 // PHP version . 4 // the PHP + 7.0.33-0 deb9u1 (CLI) (Built: On Dec 2018 11:36:49. 7) (the NTS) . 5 // Copyright (C) 1997- at The PHP Group 2017 6 // the Zend Engine V3.0.0, Copyright (c) 1998-2017 the Zend Technologies 7 // with the Zend OPcache v7.0.33-0 + deb9u1, Copyright (c) 1999-2017, by the Zend Technologies 8 // 9 // VS code information 10 // version: 1.36.0 11 // submit: 0f3794b38477eea13fb47fbe15a42798e6129338 12 // date: 2019-07-03T13: 20: 56.241Z 13 // Electron: 4.2.5 14 // Chrome: 69.0. 3497.128 15 // Node.js: 10.11.0 16 // V8: 6.9.427.31-electron.0 17 // OS: Linux x64 4.15.0-30deepin-generic
1. (positive and negative) and integer (positive or negative) obtained by adding an integer (positive or negative) integers.
1 $a = 1; 2 $b = 1; 3 var_dump( $a + $b ); 4 $a = 1; 5 $b = -2; 6 var_dump( $a + $b ); 7 // int(2) 8 // int(-1)
2. (positive and negative) and float (positive and negative) are added to give float (positive and negative) float, as a result (positive or negative) integer, the output (positive or negative) integers, but still to a float type type.
1 $a = 1.0; 2 $b = 1.0; 3 var_dump( $a + $b ); 4 $a = 1.0; 5 $b = -2.0; 6 var_dump( $a + $b ); 7 // float(2) 8 // float(-1)
3. two string type (positive or negative) integer addition, as a result (positive or negative) integers.
1 $a = '1'; 2 $b = '1'; 3 var_dump( $a + $b ); 4 $a = '1'; 5 $b = '-2'; 6 var_dump( $a + $b ); 7 // int(2) 8 // int(-1)
4. The two string type (positive and negative) floating-point addition, as a result (positive or negative) integer, the output (positive or negative) integers, but still floating point type.
1 $a = '1.0'; 2 $b = '1.0'; 3 var_dump( $a + $b ); 4 $a = '1.0'; 5 $b = '-2.0'; 6 var_dump( $a + $b ); 7 // float(2) 8 // float(-1)
The two sequences are added character string, the result is an integer 0.
1 $a = 'y'; 2 $b = 'j'; 3 var_dump( $a + $b ); 4 $a = 'true'; 5 $b = 'null'; 6 var_dump( $a + $b ); 7 // int(0) 8 // int(0)
6. two Boolean addition: Boolean True Gabr really integer type 2, type false boolean false Gabr have integer 0, plus a Boolean sum to obtain a true integer 1.
1 $a = true; 2 $b = true; 3 var_dump( $a + $b ); 4 $a = false; 5 $b = false; 6 var_dump( $a + $b ); 7 $a = true; 8 $b = false; 9 var_dump( $a + $b ); 10 // int(2) 11 // int(0) 12 // int(1)
7. The two types of null space obtained by adding the integer 0.
1 $a = null; 2 $b = null; 3 var_dump( $a + $b ); 4 // int(0)
8. (positive and negative) and float (positive or negative) obtained by adding an integer (positive or negative) float, as a result (positive or negative) integer, the output (positive or negative) integers, but still floating point type .
1 $a = 1.0; 2 $b = 1; 3 var_dump( $a + $b ); 4 $a = 1.0; 5 $b = -2; 6 var_dump( $a + $b ); 7 // float(2) 8 // float(-1)
9. The string (positive and negative) and floating-point character (positive or negative) integer addition, as a result (positive or negative) integer, the output (positive or negative) integers, but still floating point type.
1 $a = '1.0'; 2 $b = '1'; 3 var_dump( $a + $b ); 4 $a = '1.0'; 5 $b = '-2'; 6 var_dump( $a + $b ); 7 // float(2) 8 // float(-1)
Less -
Take *
In addition to /
Mode%
power**
Conjecture: The above five different operators in addition to mathematical rules, consistent with the above-described plus.