Open In App

PHP | Output Buffering

The PHP Language is an interpreted language, i.e. it is executed statement after statement. By default one characteristic of PHP makes it send HTML as chunks as soon as it is generated by executing the statements; this characteristic makes the loading of the webpage granular and the loading time span may appear in a haphazard manner. An Example of the following can be the loading time of a website that prevents adblocker or other similar applications, where the content loads first and then it shows the notification that says to disable the adblocker to see the content.

This is where Output Buffering comes into play. With using output buffering the generated HTML gets stored in a buffer or variable and is sent to the buffer to render after the execution of the last statement in the PHP script. This is a significant increase in performance as well as adds aesthetic value to the webpage. Following are few advantages of using Output Buffering:



Advantages of Output Buffering

Important points to note



Article Tags :