当前位置: 首页 > 网络学院 > 服务端脚本教程 > PHP > PHP操作符

PHP
PHP Libxml
PHP Math
PHP Misc
PHP MySQL
PHP SimpleXML
PHP String
PHP XML
PHP Zip
PHP Mail
用PHP5的DirectoryIterators递归扫描目录
PHP 阻止SQL注入式攻击
PHP5面向对象 - 基础 - 类和对象
PHP5面向对象 - 基础 - 类的属性( public )
PHP5面向对象 - 基础 - 类的属性( private )
PHP5面向对象 - 基础 - 方法
PHP5面向对象 - 基础 - 对象的比较
php5面向对象 - 基础 - 构造函数
php5面向对象 - 基础 - 析构函数
用PHP控制用户的浏览器 - ob*函数的使用
PHP PDO 学习笔记

PHP 中的 PHP操作符


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 1582 ::
收藏到网摘: n/a

Operators are used to operate on values.
操作符(Operator)是用来对一个值进行操作的。


PHP Operators
PHP操作符(Operator)

This section lists the different operators used in PHP.
下面的列表罗列了PHP中不同的操作符,以及它们不同的用法:

Arithmetic Operators
运算符(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 (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
分配符(Assignment Operators)

Operator
符号
Example
案例
Is 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

Comparison Operators
比较符(Comparison Operators)

Operator
符号
Description
具体描述
Example
案例
== is equal to
等于
5==8 返回 false
!= is not equal
不等于
5!=8 返回  true
> is greater than
大于
5>8 返回  false
< is less than
小于
5<8 返回  true
>= is greater than or equal to
大于等于
5>=8 返回  false
<= is less than or equal to
小于等于
5<=8 返回  true

Logical Operators
逻辑判断符(Logical Operators)

Operator
符号
Description
描述
Example
案例
&& and
x=6
y=3

(x < 10 && y > 1) 返回 true

|| or
x=6
y=3

(x==5 || y==5) 返回 false

! not
x=6
y=3

!(x==y)返回true

评论 (0) All

登陆 | 还没注册?