PHP mobile internet development operator

Source: Internet
Author: User
Tags php operator
PHP100 is the first professional website in China to share PHP resources. It also provides a PHP Chinese communication community. For PHP study researchers: The latest PHP information, original content, open source code and PHP video tutorials and other related content. [Introduction] I. PHP operator PHP has a rich set of operators, most of which are directly from the C language. Operators can be divided into arithmetic operators, string operators, value assignment operators, bitwise operators, conditional operators, and logical operators. When various operators are in the same

PHP has a rich set of operators, most of which are directly from the C language. Operators can be divided into arithmetic operators, string operators, value assignment operators, bitwise operators, conditional operators, and logical operators. When operators are in the same expression, their operations have a certain priority.

(1) arithmetic operations

+-*/% + + --

(2) string operators

The character string operator has only one. (point), which is an English ending. It can connect a string to form a new string, or connect a string to a number. the type is automatically converted.

$ A = "dawanganban"; $ B = "123"; echo $ a. $ B; // output result: dawanganban123

(3) value assignment operator

= + =-= * =/= % =. = $ A = "dawanganban"; $. = 1; $. = 2; $. = 3; echo $. $ B; // output result: dawanganban123

(4) bitwise operators

& | ~ ^ <>

(5) comparison operators

><>==! = <>==! =

<>: Not equal to or! = Same

===: Constant, equal value and consistent type

! ==: Non-constant, with inconsistent values or types

  1. Echo 5 = "5"; // true PHP is a weak language (variables in js are similar) echo 5 = "5"; // false is completely equal

(6) logical operations

AND (logical AND) OR (logical OR) XOR (logical OR) & (logical AND) | (logical OR )! (Non-logical)

var_dump(5 && "");   //false  var_dump(5 && "2"); //true  var_dump(5 || ""); //true  var_dump(0 xor 1); //true  var_dump(0 xor 0); //false  var_dump(1 xor 1); //false

I. PHP operators

PHP has a rich set of operators, most of which are directly from the C language. Operators can be divided into arithmetic operators, string operators, value assignment operators, bitwise operators, conditional operators, and logical operators. When operators are in the same expression, their operations have a certain priority.

(1) arithmetic operations

+-*/% + + --

(2) string operators

The character string operator has only one. (point), which is an English ending. It can connect a string to form a new string, or connect a string to a number. the type is automatically converted.

$ A = "dawanganban"; $ B = "123"; echo $ a. $ B; // output result: dawanganban123
(3) value assignment operator

= + =-= * =/= % =. = $ A = "dawanganban"; $. = 1; $. = 2; $. = 3; echo $. $ B; // output result: dawanganban123
(4) bitwise operators

& | ~ ^ <>

(5) comparison operators

><>==! = <>==! =

<>: Not equal to or! = Same

===: Constant, equal value and consistent type

! ==: Non-constant, with inconsistent values or types

  1. Echo 5 = "5"; // true PHP is a weak language (variables in js are similar) echo 5 = "5"; // false is completely equal

(6) logical operations

AND (logical AND) OR (logical OR) XOR (logical OR) & (logical AND) | (logical OR )! (Non-logical)

var_dump(5 && "");   //false  var_dump(5 && "2"); //true  var_dump(5 || ""); //true  var_dump(0 xor 1); //true  var_dump(0 xor 0); //false  var_dump(1 xor 1); //false

The above is a detailed description of PHP mobile internet development operators. For more information, see other related articles in the first PHP community!

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.