Exit() Vs Yii::app()->End

What is difference between PHP’s native exit() methos and Yii::app()->end

Hi Ahir!

In Yii framework you should prefer Yii::app()->end rather than PHP exit().

with Yii::app()->end you could use onEndRequest event and write your code before your web application completely ends. With php exit you have not this advantage…

Before will finish work application there is a call event "onEndRequest" (if it was defined)

in the onEndRequest some works are done, for example writing logs and rendering the log panel.

If you are preparing a json response maybe you want to call exit in order to block the debug panel.