05
Apr
2008
比较和逻辑运算符
|
符 号 |
含 义 |
类 型 |
示 例 |
|
= = |
等于 |
比较 |
$x == $y |
|
!= |
不等于 |
比较 |
$x != $y |
|
< |
小于 |
比较 |
$x < $y |
|
> |
大于 |
比较 |
$x > $y |
|
<= |
小于或等于 |
比较 |
$x <= $y |
|
>= |
大于或等于 |
比较 |
$x >= $y |
|
! |
非 |
逻辑 |
!$x |
|
&& |
与 |
逻辑 |
$x && $y |
|
|| |
或 |
逻辑 |
$x || $y |
|
XOR |
异或 |
逻辑 |
$x XOR $y |
条件句用法
if (condition) {
//Do something!
}
和
if ((condition1)&&(condition2)) {
//Do something!
}
或者
if (condition) {
//Do something!
}else{
//Do something else!
}
和
if (condition1) {
//Do something!
} elseif (condition2) {
//Do something else!
} else {
//Do something different!
}
This entry was posted on Saturday, April 5th, 2008 @ 17:42.
This entry is filed under Code, 中文.
You can follow any responses to this entry through the RSS 2.0 feed.
You can Leave a response, or Trackback from your own site.
This entry is filed under Code, 中文.
You can follow any responses to this entry through the RSS 2.0 feed.
You can Leave a response, or Trackback from your own site.



