PHP learning route and 10 PHP optimization skills

Source: Internet
Author: User
Abstract: familiar with HTMLCSSJS and basic web page elements, you can create simple web pages at the completion stage, and be familiar with Element attributes... suitable for PHP learners:


(1) familiar with HTML/CSS/JS and basic webpage elements. you can create a simple webpage by yourself at the completion stage and be familiar with Element attributes.


(2) understand the concept and operating mechanism of dynamic language, and be familiar with basic PHP syntax


(3) Learn how to combine PHP with HTML to complete simple dynamic pages


(4) learn MySQL and start designing databases.


(5) constantly consolidate PHP syntax, familiarize yourself with most common PHP functions, understand object-oriented programming, MySQL optimization, and some templates and frameworks


(6) final completion of a fully functional Dynamic Site


Share 10 tips for optimizing PHP performance:


(1) foreach is more efficient. use foreach instead of while and for loops.


(2) do not declare variables inside the loop, especially variables such as objects.


(3) in multiple nested loops, if possible, the longest cycle should be placed on the inner layer, and the shortest cycle should be placed on the outer layer to reduce the number of cross-cycle cpu layers and optimize program performance.


(4) use single quotes instead of double quotes to reference strings to optimize PHP performance


(5) replace I = I + 1 with I + = 1. Meets the c/c ++ habits and is highly efficient.


(6) optimize Select SQL statements and perform Insert and Update operations as little as possible to optimize PHP performance.


(7) perform as few file operations as possible, although PHP file operations are not efficient.


(8) use PHP internal functions as much as possible


(9) do not use regular expressions when using internal PHP strings to operate functions.


(10) feof, fgets, and fopen. when file_get_contents can be used to replace file and series methods, file_get_contents should be used as much as possible because it is much more efficient. Note the PHP version of file_get_contents when opening a URL file.

The above is the PHP learning route and 10 PHP optimization skills. For more information, see PHP Chinese network (www.php1.cn )!

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.