Quantcast
Channel: PHP-Scripts Blog
Viewing all articles
Browse latest Browse all 10

41 PHP optimization tips

$
0
0

As with any tips for optimization, it’s best advised to benchmark your code first rather than just start hacking and slashing your code. With that said and understood, I enjoy reading articles for better optimizing PHP code and came across this one from reinholdweber with 40 tips + 1 bonus tip that looks pretty good. These items stuck out to me, but haven’t directly benchmarked all of them (yet, but I will be checking the ones I didn’t already learn) them to test:

12. Error suppression with @ is very slow.
13. $row[’id’] is 7 times faster than $row[id]
25. When echoing strings it’s faster to separate them by comma instead of dot. Note: This only works with echo, which is a function that can take several strings as arguments.
32. Learn to love the ternary operator.

Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images