PHP Basic Introductory Tutorial _php Tutorial

Source: Internet
Author: User
Operator is the basic content that will be used in any development language, let me introduce some of the basics of PHP operators and how to use them.

Operator is used to operate on a value.

PHP operators

This section lists the various operators used in PHP:

Arithmetic operators

operator Description Example Results
+ 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 (Division remainder) 5%2
10%8
10%2
1
2
0
++ Increment X=5
X + +
X=6
Decrement X=5
X –
X=4

Assignment operators

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 to 5==8 returns False
!= is not equal 5!=8 returns True
> is greater than 5>8 returns False
< is less than 5<8 returns True
>= is greater than or equal to 5>=8 returns False
<= is less than or equal to 5<=8 returns True

logical operators

operator Description Example
&& and X=6
Y=3 (x < ten && y > 1) returns True
|| Or X=6
Y=3 (x==5 | | y==5) returns false
! Not X=6
y=3! (x==y) returns True

http://www.bkjia.com/PHPjc/628648.html www.bkjia.com true http://www.bkjia.com/PHPjc/628648.html techarticle operator is the basic content that will be used in any development language, let me introduce some of the basics of PHP operators and how to use them. Operator is used to operate on a 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.