1. In the case of file_get_contents instead of file, fopen, feof, Fgets and other series of methods, try to use file_get_contents, because he is much more efficient! But pay attention to file_get_ Contents PHP version problem when opening a URL file;
1. Replace double quotation marks with single quotes to include strings, which is faster. Because PHP will search for variables in strings enclosed by double quotes, but not in single quotes. Note: Only echo can do this, it is a "function" that can
1, if the method of the class can be defined as static, as far as possible to define as static, it will increase the speed of nearly 4 times times.2. The speed of $row [' ID '] is 7 times times that of $row[id].3. Echo is faster than print, and uses
1. if you want to specify an identifier in a template as a type, even if the intent is obvious, the keyword typename is indispensable. Therefore, the general rule is that, in addition to the typename modification, any identifier in the template is
As a php programmer, there are 40 suggestions for PHP code optimization:
1. If a method can be static, it will be declared as static. The speed can be increased to 4 times.
2. echo is faster than print.
3. Use multiple echo parameters instead of
PHP efficient writing, php High Efficiency1. Static as much as possible:
If a method can be static, it is declared as static, and the speed can be increased by 1/4, or even increased by nearly three times during my testing.Of course, this test
The execution efficiency of programs is very important. Low execution efficiency means that you need to invest more in the server hardware. However, the final result is that your program execution efficiency is low, even hardware cannot be solved.
0,Use single quotes instead of double quotes to include strings. Because PHP will search for variables in strings enclosed by double quotes, but not in single quotes. Note: Only echo can do this, it is a "function" that can treat multiple strings as
1. Static Method as much as possible: if a method can be static, it should be declared as static. The speed can be improved by 14, or even improved by nearly three times during my testing. Of course, this test method needs to be executed more than 10
1. When file_get_contents can be used to replace file, fopen, feof, fgets, and other methods, try to use file_get_contents, because its efficiency is much higher! Note the PHP version of file_get_contents when opening a URL file;2. Perform as few
This article mainly introduces 53 details of PHP code optimization, common and important php optimization strategies. For more information, see
This article mainly introduces 53 details of PHP code optimization, common and important php optimization
Below are some development experiences compiled by php experts to improve php Execution efficiency.
Below are some development experiences compiled by php experts to improve php Execution efficiency.
Use single quotes instead of double quotes
The purpose of PHP optimization is to spend the least amount of time on the fastest running speed and the easiest to maintain code. This article gives you a comprehensive optimization technique.1. Echo is faster than print.2. Use Echo's multiple
1. Static as much as possible:If a method can be static, it is declared as static, and the speed can be increased by 1/4, or even increased by nearly three times during my testing.Of course, this test method needs to be executed more than 100,000
1, if the method of the class can be defined as static, as far as possible to define as static, it will increase the speed of nearly 4 times times.2. The speed of $row [' ID '] is 7 times times that of $row[id].3. Echo is faster than print, and uses
Php is the most widely used development language in the world. It is closely integrated with linux, apache, and mysql to form an open-source golden partner of lamp. Because of its short development cycle, free, stable, secure, easy to learn,
Php is
50 Methods to Improve PHP program running efficiency, 50 PHP program running efficiency
0,Use single quotes instead of double quotes to include strings, which is faster. Because PHP will search for variables in strings enclosed by double quotes, but
Methods for optimizing PHP programs (for better understanding) and for better understanding of php programs
1. If a method c ++ an be static, declare it static. Speed improvement is by a factor of 4. If a method can be static, make a static
Use single quotes instead of double quotes to include strings, which is faster. Because PHP searches for variables in strings enclosed by double quotes.
Use single quotes instead of double quotes to include strings, which is faster. Because PHP will
Chapter Three Basics of PHP
(3.6--3.11)
3.6 variables
Variable declaration
Variable assignment: Assign value by value/reference assignment
Variable scope:
Local variable: A variable declared in a function that can only be referenced in a
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.