Home » Labs » 5 tips to execute your PHP code more faster  

5 tips to execute your PHP code more faster


Filed under Labs

1) use echo because it is faster than print.
2) Use require() instead of require_once() where possible
3) str_replace is faster than preg_replace.
4)“else if” statements are faster than case/switch
5) $row[‘id’] is 8 times faster than $row[id]

Extra:
A PHP script will be served at least 2-10 times slower than a static HTML page by Apache. Try to use more static HTML pages and fewer scripts.

Posts you may like: