How PHP optimizes your code

Source: Internet
Author: User
1. Using Zend Optimizer
Method is added in php.ini
Zend_optimization_level=15
zned_extendsion= "Path/to/zendoptimizer.so"
Zend_loader.enable=off


Note that you can turn zend_loader off only when it's not Zend Enocder Runtime.


The last line works: The Zend_loader can be slightly faster to opimizer without executing.


2. Using the cache (program size is large)
Zend cache, Afterburner cache, APC


3. Page compression content
Gzip Compressed Web pages


4. Tips:
Replace i = i+1 with I +=1;
Use PHP intrinsic functions whenever possible
Use single-quote strings whenever possible with single-quote strings
foreach instead of while traversal array

Database aspects:
Improve the performance of your database
Upgrade servers or build a load-balanced environment
Do not underestimate the role of content compression
  • 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.