The PHP community responded actively to a some PHP optimization tips posted by Google in the series Let's make the web faster.We pointed previously to Marco's article stop telling people to optimize, and start teaching them to program. Gwynne Raskind posted a response in the Google Groups pointing that all these optimizations are incorrect.After all, these are all micro optimizations tips and you will probably find such tips useful if you are beginner PHP programmer, f... Read More »
1. If a method can be static, declare it static. Speed improvement is by a factor of 4. 2. Avoid magic like __get, __set, __autoload 3. require_once() is expensive 4. Use full paths in includes and requires, less time spent on resolving the OS paths. 5. If you need to find out the time when the script started executing, $_SERVER['REQUEST_TIME'] is preferre... Read More »
Here are some tips and explanations about php code optimization.
Use echo instead of print.
Use single('') quotes instead of double(""). Double quotes search for variables in string.
Declare static variables if possible.
Use echo’s multiple parameters instead of string concatenation("." instad of ",").
++$i is faster than $i++.
Define your variables, using static and global.
Unset or null large variables.
... Read More »
When we first sat down to start designing this site we had one priority over everything else. Speed. Not only do we hate slow loading websites, we believe in simplistic designs and are crazy about optimizing websites to the extreme. Though most of these tips can be applied for any websites, we will be focusing on wordpress tips.What is a good page loading time?Before we start optimizing the site we wanted to know what will be a good loading time to aim for. So we... Read More »
As most languages PHP allows many ways to solve a problem. Some are faster then others. Here are a few ways to improve your PHP code.LoopAt some point your program will require a loop. And loop is considered as efficiency killer if you have many nested loop (means loop in a loop) as one loop will required to run ‘n’ times and if you have 1 nested loop, this means your program will have to run n2 times. There are many ways we can define a loop in PHP. But how do y... Read More »
There are a number of tricks that you can use to squeeze the last bit of performance from your scripts. These tricks won't make your applications much faster, but can give you that little edge in performance you may be looking for. More importantly it may give you insight into how PHP internals works allowing you to write code that can be executed in more optimal fashion by the Zend Engine. Please keep in mind that these are not the 1st ... Read More »
There are a number of tricks that you can use to squeeze the last bit of performance from your scripts. These tricks won't make your applications much faster, but can give you that little edge in performance you may be looking for. More importantly it may give you insight into how PHP internals works allowing you to write code that can be executed in more optimal fashion by the Zend Engine. Please keep in mind that these are not the 1st ... Read More »