#key - bloquer la diffusion des erreurs et réagir (même les fatales)
ini_set('display_errors', '0');         
function shutdown() 
       $error = error_get_last();
       if ($error['type'] === E_ERROR) {

      //do your shutdown stuff here
      //be care full do not call any other function from within shutdown function
      //as php may not wait until that function finishes
      //its a strange behavior. During testing I realized that if function is called 
      //from here that function may or may not finish and code below that function
      //call may or may not get executed. every time I had a different result. 

      // e.g.


      //code below this function may not get executed