(1) Using static static method is 4 times faster than ordinary method
(2) echo output is faster than print
(3) Use connection characters instead.
(4) Take out the maximum before looping value, instead of taking the value in the loop
The correct method
$max = count($array);
for ($i=0;$i<$max;$ i++) {
echo $i;
}
Wrong method
for ($i=0;$i
}
(5) Use unset to release the given variable
(6) Includes and requires include the file using the full path
(7) Use strncasecmp, strpbrk and stripos instead regex
(8) Use switch instead of if else statement
(9) Suppress error characters @ performance is very low
(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 2 times slower than adding a local variable
(13) Use single quotes instead of double quotes to quote characters
(14) Using HTML is 2-20 times faster than PHP scripts
(15) Using PHP caching can speed up performance by 25%-100%
(16) $++ is slower than ++$i
( 17) Don’t overuse OOP, use it in moderation
(18) Try to use PHP built-in functions