Android programmers learn PHP development (9)-assignment and comparison logic operations-PhpStorm

Source: Internet
Author: User
Value assignment operator number:, +,-, *, %,. Comparison operator number: & gt;, & lt;, & gt;, & lt ;,,!,! Logical operators and or & amp;, or |, not, or! And xorxor are true. The same is a false die () and a message is output, and the current script value assignment operator number is exited: =, + =,-=, * =,/=, % = ,. =
Comparison operator number: >,<,=, >=, <=, == ,! = ,! =
Logical operators and or &, or |, not, or! , Xor
Xor is true and false.
Die () outputs a message and exits the current script.

 "; Echo $ name2 ."
"; $ A + = 1; // equivalent to $ a = $ a + 1; print the result: 6 echo $ ."
"; $ A-= 1; // equivalent to $ a = $ a-1; print the result: 5 echo $ ."
";/** --------------- Split line --------------- */$ str =" Wang Hang "; $ str2 =" Android "; echo $ str. $ str2 ."
"; // Print the result: Wang Hang Android // echo $ str. $ str2.5 ."
"; // You cannot directly connect to 5 echo $ str. $ str2. $ ."
"; // But you can connect to $ a (the value of $ a is 5). print the result: Wang Hang Android 5 echo" Wang Hang Android {$}
"; // Print the result: Wang Hang Android 5 echo" Wang Hang Android ". $ ."
"; // Print the result: Wang Hang Android 5 echo 'Wang hang Android '. $ .'
'; // Print the result: Wang Hang Android 5 echo' Wang Hang Android {$}
'; // Print the result: Wang Hang Android {$ a} echo "Wang Hang Android", $ ,"
"; // Print the result: Wang Hang Android 5 $ str. =" yes "; // print the result: Wang Hang is echo $ str ."
"; $ Str. =" Android programmer "; // print the result: Wang Hang is an Android programmer echo $ str ."
";/** --------------- Split line --------------- */$ html =''; $ Html. =''; $ Html. = "CSDN"; $ html. =''; $ Html. =''; Echo $ html ."
"; // Print the result: CSDN (level 1 title)/*** comparison operator number: >,<,=, >=, <=, == ,! = ,! = */$ A = "007"; $ B = 7; var_dump ($ a = $ B); // print the result: bool (false ), all equals judgment (variable types also need to be the same) echo"
"; Var_dump ($ a = $ B); // print the result: bool (true), equals to echo"
"; Var_dump ($ a = $ B); // print the result: int (7), value assignment echo"
";/*** Logical operator and or &, or |, not, or! , Xor * xor is true, the same as false */var_dump (true & true); // print the result: bool (true) echo"
"; Var_dump (true & false); // print the result: bool (false) echo"
"; Var_dump (true | false); // print the result: bool (true) echo"
"; Var_dump (! True); // print the result: bool (false) echo"
"; Var_dump (! False); // print the result: bool (true) echo"
"; Var_dump (true xor false); // print the result: bool (true) echo"
"; Var_dump (false xor true); // print the result: bool (true) echo"
"; Var_dump (true xor true); // print the result: bool (false) echo"
"; Var_dump (false xor false); // print the result: bool (false) echo"
";/** --------------- Split line --------------- */$ year = 2016; if ($ year % 4 = 0 & $ year % 100! = 0 | $ year % 400! = 0) {echo "this year {$ year} is a leap year.
"; // Print the result: 2016 of this year is a leap year} else {echo" this year {$ year} is a year
";}/** --------------- Split line --------------- * // die (" enter and exit the program! "); // Print the result: enter and exit the program! // Echo "666666"; // this line does not output/** --------------- split line --------------- * // $ link = mysql_connect ("localhost", "root ","") or die ("database connection failed! ");/** --------------- Split line --------------- */$ a = 0; $ B = 0; if ($ a = 3 & $ B = 3) {$ a ++; $ B ++;} echo $. ",". $ B."
"; // Print the result: 1, 4/** --------------- split line ------------- */$ a = 0; $ B = 0; if ($ a = 3 | $ B = 3) {$ a ++; $ B ++;} echo $. ",". $ B."
"; // Print the result: 1, 1/** --------------- split line ------------- */$ a = 0; $ B = 0; if ($ a = 3 | $ B = 3) {$ a ++; $ B ++;} echo $. ",". $ B."
"; // Print the result: 0, 0

The above is the content of PhpStorm, which is used by Android programmers to learn PHP development (9). For more information, see PHP Chinese website (www.php1.cn )!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.