This is the list of the 13 PHP coding good habits, if you have better suggestions, welcome to the comments later in this article, I am a person who likes to seek knowledge
1. When querying information from the same database using SELECT, use a join statement to get all the information you need at once, without writing multiple mysql_query/while/mysql_fetch_array statements.
2. If you call a database connection in multiple files, create a connection.php file to save your connection variables, and include this file where needed.
3. For small projects, write all of your functions in a file, if a large project is written in the object, then include this file where needed.
4. If your include file is out of control, you can create an include file that contains all the. inc files, and then include this one included file where you need it.
5. Write a document for your code, and you'll need it when you look at the code 3 months later.
6, code layout, nothing is more important than readability.
7, separate the logic and the presentation layer.
8. When writing classes, make sure you know when the best time to be coupled is the best time to expand.
9, the interface is your friend.
10. When the project gets bigger, break your code down into models, views, and controllers that are super crooks.
11. Never output post and get data until HTML tags are stripped.
12, never trust the input from the user, even if she is your mother.
13, never repeat the name of the class, remember, is forever!
The above describes the PHP programmer foreign php 13 Good habits of the summary, including the content of the PHP programmer, I hope the PHP tutorial interested in a friend to help.