元运算符(?:); 33.在你想在彻底重做你的项目前, 看看 PEAR 有没有你需要的. PEAR 是个巨大的资源库, 很多 php 开发者都知道; 34.使用 highlight_file()能自动打印一份很好格式化的页面
源代码的副本; //php100 35. 使用 error_reporting(0)函数来预防潜在的敏感信息显示给用户. 理想的错误
报告应该被 完全禁用在 php.ini 文件里.可是如果你在用一个共享的虚拟主机,php.ini 你不能修改,那 么你最好添加 error_reporting(0)函数,放在每个脚本文件的第一行(或用 require_once()来 加载)这能有效的保护敏感的 SQL 查询和路径在出错时不被显示; 36.使用 gzcompress() 和 gzuncompress()对容量大的字符串进行压缩(解压)在存进(取出) 数据库时.这种内置的函数使用 gzip 算法能
压缩到 90%; 37.通过参数变量地址得引用来使一个函数有多个返回值.你可以在变量前加个"&;"来表示按 地址传递而非按值传递;
38.Fully understand "magic quotes" and the dangers of SQL injection. I'm hoping that most developers reading this are already familiar with SQL injection. However, I list it here because it's absolutely critical to understand. If you've never heard the term before, spend the entire rest of the day googling and reading.//php100 39.使用 strlen()因为要调用一些其他操作例如 lowercase 和 hash 表
查询所以速度不是太好, 我们可以用 isset()来实现相似的功能,isset()速度优于 strlen(); 40.When incrementing or decrementing the value of the variable $i++ happens to be a tad slower then ++$i. //php100 This is something
PHP specific and does not apply to other languages, so don't go modifying your C or
Java code thinking it'll suddenly become faster, it won't. ++$i happens to be faster in PHP because instead of 4 opcodes used for $i++ you only
need 3. Post incrementation actually causes in the creation of a temporary var that is then incremented. While pre-incrementation increases the original value directly. This is one of the optimization that opcode optimized like Zend's PHP optimizer. It is a still a good idea to keep in mind since not all opcode optimizers perform this optimization and there are plenty of ISPs and servers running without an opcode optimizer.