關於 PHP 10件事 : 有可能是你不知道的或忽略的

關於 PHP 10件事 : 有可能是你不知道的或忽略的

我剛剛看到 10 things you (probably) didn’t know about PHP 這篇文章

裡面說了十件關於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.

這10件事,有幾項我自己也都沒有去重視.

或許你會覺得這10件事情不是重點

不過我認為參考看看總是不錯的

Post Tags :

阿維

阿維雜記本的偷懶維護者