(1) The static method is four times faster than the normal method.
(2) echo output is faster than print
(3) Use the connection character instead.
(4) take the maximum value before the loop, instead of taking the value in the loop.
Correct Method
$ Max = count ($ array );
For ($ I = 0; $ I <$ max; $ I ++ ){
Echo $ I;
}
Incorrect Method
For ($ I = 0; $ I <count ($ array); $ I ++ ){
Echo $ I;
}
(5) Use unset to release a given variable
(6) use the complete path for the files contained in includes and requires
(7) replace regex with strncasecmp, strpbrk, and stripos
(8) replace if else statement with switch
(9) suppress error characters @ low performance
(10) remember to close unnecessary database connections at any time
(11) $ row ['id'] is 7 times faster than $ row [id]
(12) adding a global variable is twice slower than adding a local variable.
(13) use single quotes instead of double quotes to reference characters
(14) using HTML is 2-20 times faster than PHP scripts
(15) PHP cache accelerates performance by 25%-100%
(16) $ ++ is slower than ++ $ I
(17) do not over-use OOP.
(18) Use PHP built-in functions whenever possible