Learning routes and suggestions for PHP beginners and php beginners
[Guide]This article focuses on PHP learning. I have previously introduced "important materials! PHP Resources Summary Daquan on Github, in-depth discussion of PHP class encapsulation and inheritance, PHP learning planning suggestions, and other content helpful for PHP learning, in order for you to better learn PHP, I mainly want to talk about the PHP learning line this time. At the end of this article, I will introduce 10 tips for PHP performance optimization.
This article focuses on PHP learning. I have previously introduced "important materials! PHP Resources Summary Daquan on Github, in-depth discussion of PHP class encapsulation and inheritance, PHP learning planning suggestions, and other content helpful for PHP learning, in order for you to better learn PHP, I mainly want to talk about the PHP learning line this time. At the end of this article, I will introduce 10 tips for PHP performance optimization.
We need to have a step-by-step learning process. Here we will summarize the process of learning PHP, which is consistent with that of many PHP enthusiasts:
(1) familiar with HTML, CSS, JS, and other basic webpage elements. You can create a simple webpage at the completion stage and be familiar with the 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 design the database.
(5) constantly consolidate PHP syntax, familiarize yourself with most common PHP functions, understand object-oriented programming, MySQL optimization, and some templates and frameworks.
(6) A fully functional dynamic website is finally completed.
Don't look at the above summary, so you think PHP learning is very simple. programming requires you to think carefully and practice constantly. The following describes the learning routes of PHP. First, any website is composed of web pages. To complete a website, you must first learn how to create a web page. Mastering the production technology of static Web pages is a prerequisite for learning to develop a website. Therefore, we need to learn HTML to lay the foundation for website production in the future. When learning HTML, you should learn and do it. Any element in HTML must be put into practice in person. Only by understanding what elements will play what effect can you remember deeply. reading a book without a taste of it is impossible.
Assuming that you can complete a static page, you should start to understand the dynamic language. When you get started with the dynamic language, many people may be puzzled, and the code is not directly output, however, HTML is processed by the HTML Parser, and PHP also needs to use the PHP parser to learn the same principles as HTML and want any parser to work, you must use its special syntax structure.
You should be lucky to learn PHP, because if you have learned other languages, you will find that PHP is relatively simple,
At this stage, you need to understand the concepts of HTML and PHP. Now you can let PHP calculate the sum of one and one equals a few, and then output them in the browser. Don't feel naive. Although this is a small piece of code, it is a huge step for your programming path. But now you are a cainiao.
Next, we will learn about the database. MySQL can be said to be the prime partner of PHP. We want to conquer this database. After you understand the concept of a database, we will try to connect to the database through PHP, then, the data is successfully inserted, deleted, and updated using PHP.
At this time, you may be in this state: Do you know HTML? Yes. I can compile several page la S! Do you know PHP? Yes, I will write the One-plus-one operation in the function and then call it! Do you know MySQL? Yes, I can insert and delete data in the database!
So what should we do next? Try to make a small message book, which is also a level for beginners. After a while, you finally learned to insert the form data into the database and then display it. It should be said that the prototype of a program has been born. However, you may want to read this editing forum, the development CMS. When can I write one? Don't worry, consolidate your knowledge, familiarize yourself with the essentials of PHP and MySQL development, and then look back at the message book you wrote. May you doubt that it was actually written by you? At this time, you can improve your message book. The message book should be added with the registration and paging functions. If yes, the UI can be enhanced.
How can this be learned? NO, NO, NO. It's still early. Have you ever touched OOP? What about the template and framework? Continue learning! The PHP framework provides a basic framework for building web applications, which simplifies the process of compiling web applications using PHP. It can save development time and help build more stable applications. Therefore, the PHP framework is a tool that can be used to save time and enhance your code. When you select a PHP framework for the first time, we suggest you try a few more. Each framework has its own strengths and weaknesses. For example, the Zend framework has a wide range of support systems due to its diverse features, it has been popular for a long time. CakePHP is a PHP framework later than Zend, with fewer supported systems, but more convenient and easy to use.
After learning about the object-oriented and framework, you should get into touch with XML. In short, you will never find that you have learned all of them, and there is no end to learning! Never imagine that there are too many skills to quickly learn things, but the lack of effort is nothing to do. One thing you can ensure is that you have learned PHP, and then you will certainly be able to learn other languages quickly. In turn, if you have learned other languages before, you will certainly be able to learn PHP quickly.
Learning from others' successful code is definitely beneficial and harmless. Therefore, it is the best way to learn more about the classic code that has been compiled by a great deal of effort. In addition, you may encounter difficulties and confusion when learning a technology. You may have learned half of PHP and started to develop C, some people may say that Java is good. At this time, you must stick to it and learn it thoroughly. I hope you can learn PHP and develop your desired website.
Finally, I will share 10 tips on PHP performance optimization to help you better use PHP development:
1. foreach is more efficient. Use foreach instead of the while and for loops.
2. Do not declare variables inside the loop, especially variables such as objects.
3. If possible, the longest cycle should be placed on the inner layer, and the shortest cycle should be placed on the outer layer, so as 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. In line with the c/c ++ habits, the efficiency is high.
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 you can use PHP internal strings to operate functions.
10. When file_get_contents can be used to replace file, fopen, feof, fgets, and other methods, use file_get_contents as much as possible because of its high efficiency. But pay attention to the PHP version of file_get_contents when opening a URL file. Original article: http://www.php100.com/html/dujia/2015/0113/8306.html