Ec (2); 1. Use ip2long () and long2ip () to store IP addresses to the database in integer mode, rather than string mode. This will reduce the storage space by almost half (char (15) 15 bytes, integer is 8 bytes), and it is easier to calculate whether an IP address is within a range. It also accelerates search and sorting. 2. Apply checkdnsrr () to check whether the domain name exists and verify part of the email address. Script ec (2); script
1. Use ip2long () and long2ip () to store IP addresses to the database in integer mode, rather than string mode. This will reduce the storage space by almost half (char (15) 15 bytes, integer is 8 bytes), and it is easier to calculate whether an IP address is within a range. It also accelerates search and sorting.
2. Apply checkdnsrr () to check whether the domain name exists and verify part of the email address. This checkdnsrr () built-in function can query DNS records through the corresponding domain name or IP address. Some PHP developers use this function to write a custom function that can verify part of the email address. Click to view details. Please note that this function has not been implemented on windows platform! Use Net_DNS In the PEAR library instead.
3. If you use a combination of PHP 5 + MySQL 4.1 or a later version, try the improved mysqli _ * function instead of the mysql _ * function. A superior feature of the mysqli _ * function is that prepared statements can be used. If you maintain a website that is highly dependent on the database, this function will greatly increase the database query speed. If you don't believe it, you can read this performance test article-MySQLi vs MySQL. The final result is mysqli_stmt> mysql_query> mysqli_query> mysqli_multi_query. Mysqli_stmt is the best.
4. Learn to use ternary operator ). That is, replace the if/else Condition Statement with "?" : "Indicates.
5. You don't have to recreate the wheel. First, check if anyone in the PEAR library has invented the wheel.
6. highlight_file () can format your code, which is beautiful.
7. Use the error_reporting (0) function to prevent potential sensitive error messages from being displayed to users. The best case is to configure the php. ini file on the server to directly block the display of error reports. However, if you use a VM, you will not be lucky enough to edit and modify the php. ini file. You must use another method: add the error_reporting (0); statement in the first line of php code. The advantage is that these sensitive error messages, such as SQL query statements and server physical paths, are not displayed to users.
8. Before storing a large amount of string text into the database, use gzcompress () and gzuncompress () for compression and decompression conversion. This built-in function uses the gzip algorithm to increase the text compression rate by more than 90%. Of course, full-text search cannot be performed after compression.
9. You can use "reference transfer" in parameter transfer of a function to return multiple values. Programmers with programming language basics know this usage in other languages. However, some web designers who only use the html language are confused. The answer is to use the "&" symbol to process variables and pass them by reference instead of by value.
<