PHP operator summary tutorial

Source: Internet
Author: User
Tags bitwise operators php operator
Summary of basic PHP operators. PHP is one of our development languages. it has powerful functions. This article will introduce PHP operators to friends who like PHP. Like other advanced languages, PHP has many PHP operators. The PHP package is one of our development languages. it has powerful functions. This article will introduce PHP operators to friends who like PHP. Like other advanced languages, PHP has many PHP operators. Including arithmetic operators, value assignment operators, string operators, auto-increment and auto-subtraction operators, logical operators, bitwise operators, and relational operators.

1. arithmetic operators

PHP arithmetic operators include + (plus),-(minus), * (multiplication),/(division), and % (remainder ).

2. value assignment operator

PHP assignment operators include + = (assign the value on the left plus the value on the right to the left) and-= (assign the value on the left minus the value on the right to the left), * = (multiply the value on the left by the value on the right to the left),/= (divide the value on the left by the value on the right to the left), % = (assign the remainder value of the left value to the left ),. = (connect the left string to the right and assign it to the left ).

3. string operators

The PHP string operator only has the concatenation symbol ".", which connects two strings.

4. Auto-incrementing auto-subtraction operator

PHP auto-increment and auto-increment operators have four forms: $ a ++; ++ $ a; $ a --; -- $.

5. logical operators

PHP logical operators! (Logical not), and (logical and), & (logical and), or (logical or, if either of the two expressions is true, the result is true), | (logical OR), xor (exclusive or, two expressions have and only one is true, the result is true ).

& | The priority is higher than and or.

6. bitwise operators

Bitwise operators convert all numbers into binary numbers for calculation.

Bitwise operators include & (bitwise AND), | (bitwise OR), ^ (bitwise OR), <(shifts left by bitwise), and> (shifts right by bitwise) ,~ (Bitwise inversion ).

7. relational operators

Relational operators include = (equal to) and ),! = (Not equal to), <(less than),> (greater than), <= (less than or equal to),> = (greater than or equal ).

8. Other operators

PHP operators include some operators, such as $ (variable symbol), & (variable pointer, get address), @ (no error message is displayed before the function), and ),? (Three-object operator), (comma operator),-> (object method and attribute), => (array assignment ).

9. operator priority

The PHP operator has a priority. when multiple operators are combined, the PHP operator has a higher priority first. A simple understanding is to multiply, divide, and add or subtract the code. I will not describe it here.


Bytes. Like other advanced languages, PHP has many PHP operators. Package...

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.