PHP Learning route and 10 PHP optimization tips

Source: Internet
Author: User
Learning routes for PHP learners:


(1) familiar with HTML/CSS/JS, the basic elements of the web, the completion stage can be self-made simple web pages, the element attributes are relatively familiar


(2) Understand the concept of dynamic language and operation mechanism, familiar with basic PHP syntax


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


(4) Contact learning MySQL, start designing database


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


(6) Finally complete a full-featured dynamic site


Tips for sharing 10 PHP performance optimizations:


(1) foreach is more efficient and use foreach instead of while and for loops as much as possible


(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 in the inner layer, the shortest loop in the outer layers, thereby reducing the number of cycles across the CPU, optimize program performance


(4) Use single quotes instead of double quotes to reference strings for PHP performance optimizations


(5) Replace i=i+1 with I+=1. In line with C + + habits, high efficiency


(6) Optimization of the Select SQL statement, as far as possible in the case of INSERT, update operation, to achieve the purpose of PHP performance optimization


(7) As far as possible to file operations, although the PHP file operation efficiency is not low


(8) Use PHP intrinsic functions whenever possible


(9) Do not use regular expressions in cases where PHP internal string manipulation functions are available


(ten) feof, Fgets, fopen, in the case can be used file_get_contents alternative file, series of methods, as far as possible to use file_get_contents, because it is much more efficient. But pay attention to the PHP version of file_get_contents when opening a URL file

The above is the PHP learning route and 10 PHP optimization techniques, more relevant content please pay attention to topic.alibabacloud.com (www.php.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.