PHP best practices-Practical Guide to PHP Obfuscation

Source: Internet
Author: User

Bytes ---------------------------------------------------------------------------------------------------------------------

PHP is a complex language. After years of hard work, different versions of PHP are highly inconsistent, and sometimes some bugs exist. Each version has its own unique features, redundancy, and strangeness, and it is difficult to track which version has problems. This makes it easy to understand why it is sometimes so disgusted.

Even so, it is still the most popular language in Web development. Thanks to its long history, you can find many tutorials on basic tasks such as implementing password hashing and database access. But the problem is that you may find five completely different ways to complete the task in five tutorials. Which of the following is the "correct" method? Are there any elusive bugs or traps in other ways? It is really difficult to understand, so you often need to repeatedly search for the correct answer on the Internet.

This is one of the reasons why New PHP programmers are often blamed for ugly, outdated, or insecure code. If Google's first search result was an article four years ago about a method five years ago, it would be hard for new PHP beginners to change the often blamed status quo.

This document attempts to solve the above problems by organizing a series of basic practices that are considered best practices for common confusing issues in PHP and task editing. If a low-level task has a variety of confusing implementation methods in PHP, this article will also cover.

What is
This is a guide to suggest best practices when PHP programmers encounter common low-level tasks but are not clear about the best practices (because PHP may provide a variety of solutions. For example, connecting to a database is a common task. PHP provides a lot of feasible solutions, but not all of them are good practices. Therefore, this issue will also be included in this article.

This article contains a series of short, entry-level solutions. The examples involved can be run in the Basic settings, and you should be able to convert them into something useful to you after studying them.

This article will point out something we think is the latest and best in PHP. However, this means that if you are using the old version of PHP, some features used to implement these solutions are not available to you.

This document will be updated all the time, and I will do my best to keep this document synchronized with the development of PHP.

Nothing
This document is not a PHP tutorial. You should study language basics and syntax elsewhere.

It is not a guide for common web application problems, such as cookie storage, caching, programming style, and documentation.

It is not a security guide. When this document involves some security-related issues, you also want to do some research on your own to ensure the security of your PHP application. The problems caused by your code should be your own faults.

This document does not advocate a specific programming style, pattern, or framework.

It does not advocate a specific way to complete high-level tasks such as user registration and system logon. This document is limited to some obscure or ambiguous low-level tasks caused by the long history of PHP.

It is neither a permanent solution nor a unique solution. Some of the methods described below may not be the best for your specific scenario. There are many different ways to achieve the same purpose. In particular, High-load web applications may benefit from more difficult solutions.

 

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.