The simplest PHP programmer learning route and suggestions-php Tutorial

Source: Internet
Author: User
The simplest PHP programmer's learning route and suggestions are for you to better learn PHP. this time, I mainly want to talk about the PHP learning route. at the end of this article, I will introduce 10 tips for PHP performance optimization.

Learning routes and suggestions for PHP beginners

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 basic webpage elements. you can create a simple webpage at the completion stage and be familiar with Element attributes (2) understand the concept and operation 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, start designing databases (5) constantly consolidating PHP syntax, familiarizing yourself with most common PHP functions, understanding object-oriented programming, MySQL optimization, and some templates and frameworks (6) final completion of a fully functional Dynamic Site

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, all websites are 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 websites. 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 will not work.

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 have a lot of questions, 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 dedicated 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, and the number, and then output it 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, the data will be inserted, deleted, and updated successfully 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 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. 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 you can use PHP internal strings to operate functions.

10. feof, fgets, and fopen. when file_get_contents can be used to replace the file and series methods, file_get_contents should be used as much as possible because of its high efficiency. Note the PHP version of file_get_contents when opening a URL file.

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.