Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overloading PHP die() function

I need to overload the die() function. For example, I want to pass an extra parameter to die() function which is when set to true, it sends an email to me that something abnormal happened to the site. Can you please help me out!!!

Thanks to all...

like image 266
D3 K Avatar asked Apr 16 '26 05:04

D3 K


1 Answers

Hi all ... I need to overload the die() function.

No, you don't.

You could use set_error_handler or register_shutdown_function to run some code on a PHP error.

I'll leave it as an exercise to the reader to check through the documentation and experiment to see which shutdown scenarios these functions will be triggered for.

like image 159
Lightness Races in Orbit Avatar answered Apr 21 '26 00:04

Lightness Races in Orbit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!