"PHP" PHP operator

Source: Internet
Author: User

First, Introduction:

A) There may be some small differences between the operators in mathematics and the operators in PHP, but the difference is that they are used to do the calculations; the only difference is that the operators in PHP are categorized more

Second, the composition of the operation in PHP

A) 1 + 2 = 3

b) +: operator

c) 1 and 2: operational elements

D) =: operator

e) 3: Results

Iii. classification of operators in PHP

1. Unary operations: Operations with only one value

2. Two-dollar operation: operation between two values

3. Ternary operations: operations between three values

b) Arithmetic operators

1. + Plus

2.– minus

3. * Multiplication Sign

4./Division Sign

A) the divisor or divisor is negative, the result is negative, they are negative at the same time, the result is a positive number

5.% take-off (modulo)

A) as long as the dividend is negative, the residual result is negative.

6. + + increments

A) belongs to unary operations

7.--Decrement

c) Assignment operator

1. = Assignment assigns the value to the right of the equal sign or the result of an expression to the left variable

2. + = $a + = $b equivalent to $a = $a + $b

A) The result of the addition of all the variables on both sides is assigned to the left variable;

3.-= $a-= $b equivalent to $a = $a-$b

4. *= $a *= $b equivalent to $a = $a * $b

5./= $a/= $b equivalent to $a = $a/$b

6.%= $a%= $b equivalent to $a = $a% $b

d) Comparison operators

1. > Greater than

2. < less than

3. >= greater than or equal to

4. <= less than or equal to

5. = Does not equal

6. = = Whether the judgment is equal

A) Note: Just determine whether the content of the two values is equal, and if it is a different type of content, there will be such a process of automatic type conversion

7.!== judgment is not congruent

8. = = = Whether the judgment is congruent

A) Note: To determine whether two values are congruent, compare the length, type, and content of the value

e) String operators

1.. String connector

2. = $a. = $b equal to $a. $b;

A) Note: Here the string link does not restrict the type

f) Logical operators

1. Logic OR OR | |

A) Features: the expression on either side of the logic or symbol can be satisfied by one side

b) Short-circuit effect: Judging from the beginning of the expression, if the starting conditions are met, the other conditions are no longer executed;

2. Logic and &&

A) Features: Both the logic and the expression on both sides of the symbol must be met at the same time to

b) Short-circuit effect: Judging from the beginning of the expression, if the starting condition is not met, the other conditions are no longer executed

3. Logic is not!

A) Feature: Reverse the result of the conditional expression. True is false, right is wrong

g) Bitwise operators

1. & Position and

A) Features: The binary number of two values is compared between bit and bit, the same as 1 bit is 1, otherwise 0

2. | Bit or

A) Features: The binary number of two values is compared between bit and bit, as long as there are 1 bits, then 1, two bits if all 0 is 0

h) Other operators

1. @ ERROR Suppressor

A) add it in front of the wrong position, but not recommended

b) It cannot suppress grammatical errors

2. ' Anti-quote operator '

A) the anti-quote operator can execute a command line in the DOS command box of Linux or Windows

b) Note: It is not recommended to use

3.? : Ternary operator

A) pseudo-code:

I. Conditional expression 1? Conditional expression 2: conditional expression 3

1. Expression 1: Conditions for judging

2. Expression 2: If the condition of expression 1 is set to execute the interval

3. Expression 3: If the condition of expression 1 does not establish the interval of execution

Ii. Execution Order: First determine whether the execution result of the conditional expression 1 is true, if true, the content of expression 2 is executed, otherwise the content of expression 3 is executed

4. () Priority of the ascending operator

5. Operator Precedence

A) View by: Php manual, left sidebar precedence of operator---operators, language reference

i) range of storage size:

1.1Tb = 1024Gb

2.1Gb = 1024Mb

3.1Mb = 1024kb

4.1kb = 1024 bytes

5.1 bytes = 8 bits

Iv. accept the contents of the form submission data:

A) POST mode: $_post[' The name of the ' form item ']

b) GET mode: $_get[' form item's name ']

"PHP" PHP 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.