Learning routes and suggestions for PHP beginners

Source: Internet
Author: User
Learning routes and suggestions for 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

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.