PHP operators-PHP Basics-PHP Tutorial

Source: Internet
Author: User
Tags php basics php operator
PHP operator basics tutorial. Operators are the basic content used in any development language. next I will introduce some basic knowledge and usage of PHP operators. The PHP operator is the basic content used in any development language. next I will introduce some basic knowledge and usage of the PHP operator.

The operator is used to calculate the value.

PHP operators

This section lists various operators used in PHP:

Arithmetic operators

Operator Description Example Result
+ Addition X = 2
X + 2
4
- Subtraction X = 2
5-x
3
* Multiplication X = 4
X * 5
20
/ Division 15/5
5/2
3
2.5
% Modulus (pision remainder) 5% 2
10% 8
10% 2
1
2
0
++ Increment X = 5
X ++
X = 6
- Decrement X = 5
X-
X = 4

Value assignment operator

Operator Description Example
= X = y X = y
+ = X + = y X = x + y
-= X-= y X = x-y
* = X * = y X = x * y
/= X/= y X = x/y
. = X. = y X = x. y
% = X % = y X = x % y

Comparison Operators

Operator Description Example
= Is equal 5 = 8 returns false
! = Is not equal 5! = 8 returns true
> Is greater 5> 8 returns false
< Is less 5 <8 returns true
> = Is greater than or equal 5> = 8 returns false
<= Is less than or equal 5 <= 8 returns true

Logical operators

Operator Description Example
&& And X = 6
Y = 3 (x <10 & y> 1) returns true
| Or X = 6
Y = 3 (x = 5 | y = 5) returns false
! Not X = 6
Y = 3! (X = y) returns true

Bytes. Operator is used to calculate the value. 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.