Cache
Caches can save your CPU cycles and give you extra speed. When script starting loading it will take one second, which is one third part of three second of total load time, the first time, it is worth to spend because it won’ take any time when it runs additional times because you have already cached the execution of the function. The function is always return the same date not current time so you can take help of several tools like Memcache or new powerful Varnish, but in case of Memcache that allows you to set a Time To Live (TTL) in the data stored and this feature can set one refresh policy to the cached data. It is not real time outcome, but your server will save a lot of resources particularly during heavy load and with lot of concurrent users.
It is true that Memcache won’t persist the data so you will lost with each restart therefore enable your PHP web application to rebuild the caches if it is empty also don’t rely on the existence of data in cloud environment. Varnish creates more advanced caches so you can cache different parts of your site with a different TTL. Varnish is HTTP accelerator as it is a mix of caches and HTTP reverse proxy therefore, it is flexible and customizable and due to these reasons it is integrated part of modern PHP web application frameworks like Symfony2.
Loops
We usually use loops in PHP web application development, but they can cause bottlenecks. One slow operation executed once is one problem, but in loops it multiplies. In such cases you can take help of profiling tools like Xdebug and Zend Debugger. They generate reports which help us to detect bottlenecks.
Read More:- PHP MySQL Development—Enables Go to Any Extent