2014-04-04

1.CSS特殊属性,取消点击事件:  pointer-events:none

2.PHP数组 反转函数:array_flip()

3.使用echo的多重参数(译注:指用逗号而不是句点)代替字符串连接。

 eg:

$test = " hello ";
echo $test , "fanwenqi"," is a "," good boy!";

4.尽量不要在for循环中使用函数,比如for ($x=0; $x < count($array); $x)每循环一次都会调用count()函数

5.  if (!isset($foo{5})) { echo "Foo is too short"; }    <=>  if (strlen($foo) < 5) { echo "Foo is too short"; }

6.获取网站ip:$ip   gethostbyname('www.example.com');

7.将ip转换成长整型存放在数据库:$long ip2long($ip);

8.在验证 email 地址的时候使用 checkdnsrr() 函数验证域名是否存在 (php 5.3以后才能使用)

9.如果你在项目中感觉到有可复用的部分,在你写下一行代码前先看看 PEAR 中是否已经有了

10. 在网数据库中存储很大的字符串之前使用 gzcompress() 和 gzuncompress() 来显式的压缩/解压字符串

11. 通过"引用"传递参数的方法从一个函数中得到多个返回值。

12.get_headers()

13.memory_get_peak_usage() 获取内存的峰值

15.浮点数比较运算使用  bccomp

原文地址:https://www.cnblogs.com/justphp/p/3645194.html