易截截图软件、单文件、免安装、纯绿色、仅160KB

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


相关文档:

php的session用法小结

 session是网站保存用户信息的一种手段,应用相当广泛。例如第五届排行榜就使用了session。经过对第五届排行榜的修改,我总结了一下php中session的用法。
(一)开始session
  在每一次使用session之前,都要加上这一句:“session_start();”。顾名思义,这个函数的作用就是开始使用session。
(二)注 ......

php 防注入攻击函数

/*php 防注入函数
string  $feifa  限制元素组成
如有非法字符跳转到上一页 返回 0  没有返回 1
*/
//使用方法
//$feifa=array("select","delete","from","update","create","destory","drop","alter" ......

编译php支持curl和pdo_mysql

安装curl
  
  
  1. curl 是 php 標準庫,所以可以在原來的 phpX.X.X.tar.gz 中找到。
  2. 進入 php 目錄中的 ext 找到 curl
  3. 在 curl 目錄中執行 /usr/local/php5-fastcgi/bin/phpize
  4. 再來將他生成的檔案進行 ./con ......

php常用的正则过滤


$str=preg_replace("/\s+/", " ", $str); //过滤多余回车   
$str=preg_replace("/<[ ]+/si","<",$str); //过滤<__("<"号后面带空格)   
  
$str=preg_replace("/<\!--.*?-->/si","",$str); //注释   
$str=preg_replace("/<(\!.*?)>/si","",$s ......

php include文件后多出一空白行

用多种编辑软件修改过的php网站可能会遇到一很怪问题:用include引入的footer和header文件都在上面多出一空白行,直接把被引入的文件放入则没问题。这个问题极有可能是编码问题引起的。如果采用utf-8编码要设置为无bom,并且要所有的涉及到的页面包括css及其他文件都要以无bom的utf-8编码。具体方法可以是:在Dreamweaver里 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号