Basic PHP operator Summary _php Tutorial

Source: Internet
Author: User
Tags arithmetic operators bitwise bitwise operators php operator
PHP is one of our development languages, it has a powerful feature, the article here to like PHP friends to introduce PHP operators. PHP, like other high-level languages, has a number of PHP operators. Includes arithmetic operators, assignment operators, string operators, self-increment decrement operators, logical operators, bitwise operators, relational operators, and so on.

1. Arithmetic operators

The PHP arithmetic operators have + (plus),-(minus), * (multiply),/(except),% (remainder).

2. Assignment Operators

The PHP assignment operator has + = (assigns the left-hand value to the left),-= (assigns the left-hand value minus the right value to the left), *= (assigns the left-hand value to the left),/= (assigns the left-hand value to the left),%= ( Leave the value on the left to the left),. = (the left string is concatenated to the right to the left).

3. String operators

The PHP string operator has only a connection symbol ".", which connects two strings.

4. Self-increment self-decrement operator

There are four types of PHP self-decrement operators: $a + +, + + $a, $a--;--$a.

5. Logical operators

PHP logical operators have! (logical non), and (logical AND), && (logical AND), or (logical OR, two expressions as long as one is true, the result is true), | | (logical OR), XOR (two expressions have only one is true, the result is true).

&& | | Priority is higher than and and OR.

6. Bitwise operators

Bitwise operators are calculated by converting all the numbers into binary numbers.

Bitwise operators have & (bitwise AND), | (bitwise OR), ^ (bitwise XOR), << (bitwise left), >> (bitwise right SHIFT), ~ (bitwise reversed).

7. Relational operators

The relational operators have = = (equals),! = (not equal), < (less than), > (greater than), <= (less than or equal), >= (greater than or equal).

8. Other operators

The PHP operator also has some operators, such as $ (variable symbol), & (variable pointer, fetch address), @ (added before the function, does not display an error message),?:( The trinocular operator),, (comma operator), (method and property of the object), + = (array Assignment).

9. Operator Precedence

The PHP operator has precedence, and a number of operators are prioritized first. The simple understanding is the first multiplication after the addition and subtraction, here no longer repeat.


http://www.bkjia.com/PHPjc/446525.html www.bkjia.com true http://www.bkjia.com/PHPjc/446525.html techarticle PHP is one of our development languages, it has a powerful feature, the article here to like PHP friends to introduce PHP operators. PHP, like other high-level languages, has a number of PHP operators. Package ...

  • Related Article

    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.