PHP Development Work Experience

Source: Internet
Author: User

First, the basic knowledge of PHP itself, functions, constants, and so on, as far as possible to solve this problem with the built-in method (because the individual writing often run efficiency is not built-in method high);

Second, the code as little as possible to achieve the function (because the PHP operation is in fact, will our code first processed into the underlying language for the machine to run, assuming that the code is many, the content of the conversion more natural time-consuming);

Third, the optimization can be measured by the pressure test AB test their own code, and the code optimization, again pressure measurement efficiency;


Four, less with the @ symbol;

Use the unset () function more than five. The variable is written off and released;

Six, the less use of the form, double-edged sword;

Seven, avoid the loop for the loop condition to do the operation;

Eight, the key value of the array, be sure to use the quoted string as the key value, why do you have to do this?

When $arr = Array ("key" = "hehe"); $arr ["Key"] is correct, efficiency-enhancing

$arr [key] does not have an argument, it is not good, due to PHP runtime. Found key without an argument

At this point, he will check to see if the key is a constant. If you turn on the error mechanism, you will be prompted notice

The constant is not found for key.

Assuming that the argument is added, PHP will go directly to the $arr array to find the key value for key.

relative efficiency is efficient.

Ix. external factors that affect PHP performance are:


The inspiration for this point is that when a site is very slow. Perhaps not the performance of PHP itself is slow, may be a network problem, may be a hardware problem, etc., as an architect to troubleshoot the problem can not stay in the program optimization!

It is more efficient to read the contents of memory than to read the contents of the database. So the large-volume speed-up site often uses memcache, Redis and other distributed caches to cache data to memory. Then the data is read with the memory first.


Xi. through Xhporf (from the Facebook Test PHP Performance analysis tool). Ability to test the process of visiting the site. and can through the flow chart red area high-speed find, time-consuming method, the method optimization can be;


PHP Development Work Experience

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.