PHP, a nested abbreviated name, is the abbreviation for the English Hypertext Preprocessing language (Php:hypertext preprocessor). PHP is an HTML embedded language, PHP and Microsoft's ASP somewhat similar, is a server-side embedded HTML document script language, language style has similar to C language, is now widely used by many web programmers. PHP's unique syntax blends C, Java, Perl, and PHP from innovative syntax.
&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; It can execute dynamic Web pages faster than CGI or Perl. Dynamic pages made with PHP compared to other programming languages, PHP embeds programs into HTML documents and executes more efficiently than CGI that completely generates HTML tags; php executes on the server side compared to scripting language JavaScript, which is also embedded in HTML documents. Take full advantage of the performance of the server; the PHP execution engine also hosts the PHP programs that users frequently visit in memory, and other users don't need to recompile the program once again, as long as they execute the code directly in memory, which is one of the most efficient embodiments of PHP. PHP has a very powerful function, all of the CGI or JavaScript features PHP can be implemented, but also support almost all popular databases and operating systems.
1. Use the Ip2long () and LONG2IP () functions to convert the IP address into an integral type stored in the database. This approach minimizes storage space to nearly One-fourth (4 bytes of 15 bytes of char (15)), calculating whether a particular address is simpler in one section, and speeding up search and sorting (though sometimes just a little faster).
2. Use the CHECKDNSRR () function to verify that the domain name exists when verifying the email address. This built-in function confirms that the specified domain name resolves to an IP address. The user comments section of the PHP document for this function has a simple user-defined function that is based on CHECKDNSRR () to verify the legality of the email address. For those who think their email address is "joeuser@wwwphp.net" rather than "joeuser@php.net", this approach can easily catch them.
3. If you are using PHP 5 and MySQL 4.1 or higher, consider discarding the mysql_* series functions instead of the improved version of the Mysqli_* series functions. A good feature is that you can use preprocessing statements, and if you are maintaining a database-intensive site, this feature can speed up the query. Some assessment scores.
4. Learn to love ternary operators.
5. If you feel a reusable part of your project, see if it already exists in PEAR before you write down a line of code. Many PHP programmers know that PEAR is a good repository, although many programmers do not know it. This online repository contains more than 400 reusable pieces of program that you can use immediately with a knife in your program. Unless your project is really special, you can always find a PEAR bag that helps you save time. (See PECL)
6. Highlight_file () from the dynamic print out of the formatted very beautiful source code. This function is handy if you're looking for a script help on the message board and IRC. Of course, be careful not to accidentally disclose your database connection information and passwords. Before this I really did not know has highlight_string ()/highlight_file such good Dongdong
7. Use the error_reporting (0) function to prevent users from seeing potentially sensitive error messages. Ideally, the publisher should be completely banned in php.ini. But if you're using a shared Web server and you don't have your own php.ini file, your best bet is to add error_reporting (0);(or use the require_once () method before the first line of all the scripts. This makes it possible to completely block sensitive SQL query statements and path names when errors occur.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.