With over 6000 build-in functions , PHP provides a flexible platform to build our web-applications . One function that deserves to be on our top-list tool-set is register_shutdown_function() . This function allows you to execute a block of code whenever your script ends — for any reason . You could imagine it as a software hook , whatever the reason your script terminates (just finishes , die() , exit() , Fatal-Error) , a block of custom code will be executed . You can use this call to register as many shutdown functions as you want , and they will get executed in the order that they get applied . But please stay focused on the purpose it was developed for , just a bit of extra code . The functionality of your script must remain (be executed) in the main body of the PHP code .
Use of this function is very straight-forward :
View original post 201 more words