• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

operators:php operators_php

php 搞代码 3年前 (2018-06-21) 128次浏览 已收录 0个评论

php operatorsthis section lists the different operators used in php.
arithmetic operators

operatordescriptionexampleresult
+ addition x=2
x+2
4
subtraction x=2
5-x
3
* multiplication x=4

http://www.gaodaima.com/?p=50132operators:php operators_php

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

operatorexampleis the same as
= 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

operatordescriptionexample
== 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

operatordescriptionexample
&& 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

本文链接http://www.cxybl.com/html/wlbc/Php/20120531/27128.html

欢迎大家阅读《operators:php operators_php》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码


喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址