11-php Boolean, floating point, string details, and expressions and Arithmetic Operators

Source: Internet
Author: User
<? PHP # boolean data type details: false # ① false itself # ② $ A = 0/* $ A = 0; if ($ A = false) {echo "false! ";}*/# ③ $ A = 0.0/* $ A = 0.0; if ($ A = false) {echo" not true ~ ";} */# ④ $ A =" "(empty string)/* $ A =" "; if ($ A = false) {echo" this is not true! ";} */# ⑤ $ A = NULL/* $ A = NULL; if ($ A = false) {echo" null is false! ";} */# No element in the array is false #7. What is the object that does not contain any member variables?>

 
<? PHP // floating-point data details // ① the precision of the floating-point data type is 14, and the calculation method starts from the left to the first digit not 0. // ② Case // $ A = 0.123456789012345; // echo '$ A = '. $ A; // The result is: $ A = 0.12345678901234 // If $ A = 0.123456789012346; $ A = 0.123456789012346; $ B = 0.000006789012345; // The result is: $ B = 6.789012345e-6 echo '$ B = '. $ B;?>

<? PHP // string note details // one character E. g A occupies one byte // ① difference between single quotation marks and double quotation marks // Example 1: Echo ① difference between single quotation marks and double quotation marks 1 double quotation marks parse variables <br/> '; $ I = 90; $ user1 = "Hello $ I"; $ user2 = 'Hello $ I '; echo' $ user1 = '. $ user1; echo '<br/> $ user2 = '. $ user2; // The result is: $ user1 = hello90 // $ user2 = Hello $ iecho '<HR/> '; // use double quotation marks to parse special characters. // For example, Echo '② difference between single quotation marks and double quotation marks. 2 double quotation marks will parse special characters. <br/> '; $ V1 = "ABCD \" "; $ v2 = 'abcd \" '; echo 'v1 = '. $ V1; echo '<br/> v2 = '. $ V2; echo '<HR/>'; // double quotation marks are used to parse double quotation marks, and single quotation marks are used to parse single quotation marks echo '③ single quotation marks and double quotation marks Double quotation marks are enclosed in double quotation marks. single quotation marks are enclosed in single quotation marks. <br/> '; $ V1 = 'abcd \ ''; $ v2 =" ABCD \'"; echo 'v1 = '. $ V1; echo '<br/> v2 = '. $ V2;?>

Expression: A value is an expression. Example: $ A = 90;

 
<? PHP // PHP Arithmetic Operator // determines whether two numbers can be divisible by $ A = 5; $ B = 1; if ($ A % $ B = 0) {echo 'a can divide B, and the result is :'. ($ A % $ B);} else {echo 'a cannot divide B, and the result is :'. ($ A % $ B) ;}?>

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.