我剛剛看到 10 things you (probably) didn’t know about PHP 這篇文章
1. Use ip2long() and long2ip() to store IP addresses as integers instead of strings in a database.
2. Partially validate email addresses by checking that the domain name exists with checkdnsrr().
3. If you’re using PHP 5 with MySQL 4.1 or above, consider ditching the mysql_* functions for the improved mysqli_* functions.
4. Learn to love the ternary operator.
5. If you get the feeling that you might be reinventing the wheel during a project, check PEAR before you write another line.
6. Automatically print a nicely formatted copy of a page’s source code with highlight_file().
7. Prevent potentially sensitive error messages from being shown to users with the error_reporting(0) function.
8. Use gzcompress() and gzuncompress() to transparently compress/decompress large strings before storing them in a database.
9. Return multiple values from a function with “by reference” parameters.
10. Fully understand “magic quotes” and the dangers of SQL injection.