PHP best Practices (translated)--php Practical Guide to confusing technology _php tutorials

Source: Internet
Author: User
--------------------------------------------------------------------------------------------------------------- ------

PHP is a complex language, after years of tossing, so that its different versions are highly inconsistent, and sometimes some bugs. Each version has its own unique features, redundancy, and quirks, and it's hard to track which version has problems. This is also a good understanding of why sometimes it is so much disgust.

Still, it is now the most popular language for WEB development. Because of its long history, you can find many tutorials for basic tasks such as password hashing and database access. But the problem is that, with 5 tutorials, you're likely to find 5 different ways to accomplish the task, which is the "right" way? Other ways to have elusive bugs or pitfalls? It's really hard to understand, so you often have to look over the internet repeatedly to try to confirm the correct answer.

This is one of the reasons that novice PHP programmers are frequently blamed for ugly, outdated, or unsafe code. If the first result of Google's search was a 4-year-old article about a 5-year-old approach, it would be hard for PHP novices to change the status quo that often blames them.

This document attempts to address these issues by organizing a series of basic practices that are considered best practices for the confusing issues and task editors common in PHP. If a low-level task has several confusing implementations in PHP, this article will also cover it.

What is it
This is a guide to recommending best practices for PHP programmers when they encounter some common low-level tasks but do not identify best practices (because PHP may provide multiple solutions). For example, connecting to a database is a common task, and PHP provides a number of possible scenarios, but not all are good practices, so this article also contains the issue.

This article contains a series of short, introductory-nature scenarios. The examples involved can be run under Basic settings, and you should look into what you can do to make them useful to you.

This article will point out some of the best things we think are the newest in PHP. However, this means that if you are using older versions of PHP, some of the features used to implement these solutions are not available to you.

This document will always be updated and I will try my best to keep the document in sync with the development of PHP.

Not what
This document is not a PHP tutorial. You should learn the language basics and grammar elsewhere.

It is also not a guide to Web application FAQs, such as cookie storage, caching, programming style, documentation, and more.

It is also not a safety guide. When this document touches on some security-related issues, you also want to do some research on your own to ensure that your PHP application is secure. The problem with your code should be your own fault.

The document is also not advocating a particular programming style, pattern, or framework.

is not advocating a specific way to complete high-level tasks such as user registration, login system and so on. This document is limited to some confusing or ambiguous low-level tasks caused by the long history of PHP.

It is not a once and for all solution, nor is it a unique solution. Some of the methods described below may not be the best for your particular scenario, and there are many different ways to achieve the same goal. In particular, high-load Web applications may benefit more from more difficult-to-understand scenarios.

http://www.bkjia.com/PHPjc/477322.html www.bkjia.com true http://www.bkjia.com/PHPjc/477322.html techarticle ----------------------------------------------------------------------------------------------------------- ----------PHP is a complex language, after years of tossing and making it different ...

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