PHP学习之 PHP 运算符
运算符用于对值进行运算.
PHP 运算符
本部分列出了在 PHP 中使用的各种运算符:
算数运算符
运算符说明例子结果
+
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
赋值运算符
运算符说明例子
=
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
比较运算符
运算符说明例子
==
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
逻辑运算符
运算符说明例子
&&
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
相关文档:
最近有个小东西要查看mssql数据库是用php实现的,以前我用php5.2时感觉挺简单的所以想php5.3也应该很简单的
为什么要用php5.3呢因为我想用sqlite3.0的啊,因为php5.2的不支持sqlite3.0的啊,所以我特意去下了5.3了下载回来了才发现5.3里没有mssql的dll扩展了,郁闷啊,不管这么多先用起那sqlite3.0再说了
sqlite3.0的部分 ......
安装curl
1. curl 是 php 標準庫,所以可以在原來的 phpX.X.X.tar.gz 中找到。
2. 進入 php 目錄中的 ext 找到 curl
3. 在 curl 目錄中執行 /usr/local/php5-fastcgi/bin/phpize
4. 再來將他生成的檔案進行 ./con ......
$str=preg_replace("/\s+/", " ", $str); //过滤多余回车
$str=preg_replace("/<[ ]+/si","<",$str); //过滤<__("<"号后面带空格)
$str=preg_replace("/<\!--.*?-->/si","",$str); //注释
$str=preg_replace("/<(\!.*?)>/si","",$s ......
字符串变量用于存储并处理文本片段。
PHP 中的字符串
字符串变量用于包含字符串的值。
在本教程中,我们打算介绍几个在 PHP 中用于操作字符串的最常用的函数和运算符。
在创建字符串之后,我们就可以对它进行操作了。您可以直接在函数中使用字符串,或者把它存储在变量中。
在下面,PHP 脚本把字符串 "Hello World" 赋 ......