4. Operator (1) Arithmetic Operator

Source: Internet
Author: User
(1) Arithmetic Operators 1: learning objectives, understanding operators, and modulo operations, and writing expressions. Take a deeper look at the previous knowledge about variable types. There are various types of dynamic computation in PHP. First, let's take a look at the Arithmetic Operators +-*/% that we can best understand. <? PHP $ A = 10; $ B = 0; echo $ A/$ B; // The divisor cannot be 0. $ A indicates the divisor. $ B indicates the divisor. Echo $ A + $ B; // print 10; $ A = 3200000000; $ B = 3200000000; $ c = $ A + $ B; var_dump ($ C ); // print out Why float 6.4 billion is float? The maximum integer value is about 2 billion. The float type will be interpreted if it is larger than more than 2 billion. The maximum value can be expressed by the constant php_int_max. Baidu can look at the reasons. You can understand it here.?> // Modulo <? PHP $ A = 10; // try-10; $ B = 2; // try-2; observe the print result echo $ A % $ B; // The '%' symbol is a modulo operator (remainder) in PHP and the result is 0. The positive and negative number of the modulus result is determined by the positive and negative values of the divisor. ?> Let's talk about the modulo operation. If the divisor is smaller than the divisor, for example, 3% 9, the modulo operation is 3. 9% 3 first, we calculate that Division 9/3 = 3 does not have a remainder, so the value is 0. If it is 9% 4 ?? First, calculate the last Division 2 2*4 = 8 and leave 1. Therefore, the modulo value is 1. These are just some simple mathematical operations. A little bit. You can pass.

4. Operator (1) Arithmetic Operator

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.