PHP improves programming efficiency (2) 1. str_replace functions are faster than preg_replace functions, but strtr functions are four times more efficient than str_replace functions.
2. if a string replacement function can take an array or character as a parameter and the parameter length is not too long, you can consider writing an additional replacement code so that each parameter passing is a character, instead of writing only one line of code to accept arrays as query and replacement parameters.
3. use the select branch statement.
4. blocking error messages with @ is very inefficient and extremely inefficient.
5. open the mod_deflate module of apache to speed up web browsing.
6. the database connection should be closed when use is complete. do not use persistent connections.
7. the error message is expensive.
8. increment local variables in the method at the fastest speed. It is almost the same as calling a local variable in a function.
9. increasing a global variable is twice slower than increasing a local variable.
10. incrementing an object property (for example, $ this-> prop ++) is three times slower than incrementing a local variable.