PHP comes all the way

Source: Internet
Author: User
Tags apc how to use curl php language php books php source code
Since 2012 has been in contact with PHP, until now has been done for two or three years, but also through countless detours, also through the night countless times, read all kinds of PHP books, blogs, and so on, to do a summary, all when it is a summary of their past this period of time.

PHP is a weak type of language, so-called if the type of language is not the type of distinction, but that there is no obvious type definition, PHP variables do not need to be defined in advance, only need a $ symbol can be, such as: $a/$b/$c. The implementation of PHP variables in the lower level is implemented by the community (Union) in C, except that PHP variables are automatically typed at the time of operation, and secondly, the PHP variables are based on the mechanism of "reference copying" and "copy-on-write".

PHP to later will have a kind of do not know how to learn the state, feel the realization of the function can be realized, there is nothing to learn, and indeed PHP to the late itself there is no studious, at this time can try to learn some design patterns, to see some open source code, to try to encapsulate the MVC, Try to use the native PHP language to implement encapsulation in some frameworks. After reading these, you can try to look at the PHP source code, perhaps you will find PHP source code is still difficult to understand, it's OK, it is so, you can go back to learn C and C + + before this time, perhaps you will find from C to C + + is actually a package process, you will also find that PHP source with a lot of structure (struct), define,typedef, and a large number of double triple pointers, you will find that PHP is not nothing to learn, it is necessary to dig deeper, well the next day there are things to do, look at the source of PHP, Try to implement the PHP extension and put it in your own environment to invoke it.

The late PHP is not nothing to learn, but its own language is relatively simple, if only to learn the application level of things that really have no things to learn. Well, after roughly reading the source code, you will find that PHP will be parsed into opcode before it will be executed, you will know the use of APC, memcache and RADIUS/concept, you will have a deeper understanding of PHP, then we turn to the optimization aspect.

PHP is a web development language, so it involves the optimization of the web, how to say optimization? The bottleneck of the website is usually with two places one is the bottleneck of the database, one is the bottleneck of the PHP language, the database aspect: the table structure optimization, the MySQL engine choice, the index addition, the longitudinal table, the transverse table, the master-slave database reads and writes the classification, the cluster. PHP we can from the optimization of the view layer of CSS and JS, CSS and JS compression merge, image processing, icon merging and other operations. The controller layer optimizes the SQL statements, reduces the use of associated queries and subqueries, and can take the SQL statements apart and then flatten the data. Using the page static processing part of the page is not frequently changed, using Memcache/apc/radius as the database cache, to alleviate the database pressure, The use of opcode function to reduce the parsing of PHP (php5.5 after the opcode to the APC, can also be achieved through APC), choose the faster nginx instead of Apache services, the server cluster and so on. Of course, PHP itself also has optimization techniques such as single and double quotes, the use of include and Requice, and so on, no longer described. There's a lot more you need to learn at this point.

When the feeling of learning a weak type of language does not improve, perhaps you can learn a strong type of language, such as learning Java to do JSP when you will find that JSP does not take you for granted the session, you can choose to use map, HashMap such as the existing data structure to encapsulate the session, you may have become accustomed to the framework to provide you with the functionality, but here, you do need to encapsulate a database link to read and return the data to a map in a way to facilitate your development.

When you feel like learning PHP is nothing to improve, maybe you should learn to learn Linux, actually do not need to read how many books, put on a Linux system, try to use it. You will find that Linux is actually better than windows, you can go with a set of Lnmp/lamp, try to write a little shell code, to automatically back up your database, or even to follow your PHP to achieve a certain function, You can also easily configure PHP xdebug to try to debug the PHP program with breakpoints, you can easily write some PHP extensions, configuration memcache and so on, you can try to use vim to write something, try to use the GCC compiler C try to use the GDB debugging program, Try to do more with the command line, and you'll find that PHP is really the perfect match for Linux.

This time you have been able to use Linux skillfully, why not try to implement a small framework, to analyze the common framework of the skills, PHP object-oriented, PHP magic function, how to implement the polymorphism of PHP, and how PHP is running in Apache, Why is nginx higher performance than Apache, how to share the session in multiple servers, how to use curl to invoke some of the interface implementation of the development process of the use of some occasions, how to use serialize/ Unserialize to implement some data serialization to store the use of deserialization, how to crawl some Web site content, and how to improve some of the usage habits. In short, you need to do a lot, PHP is not nothing to learn, but should not stay in the code phase, should go to learn something deeper, to believe that when you feel that there is nothing to learn when there is a large part because your knowledge is too small, the cognitive level is too shallow.

Programming is not easy, and the line and cherish, find work is not easy, so no matter at any time or try to improve themselves.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The above describes the PHP all the way, including the content, I hope the PHP tutorial interested in a friend helpful.

  • 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.