Lafix Lafix - 11 months ago 72
PHP Question

How to intentionally cause a fatal error in PHP script?

I want script to stop being executed at the point of the crash, while not to exhaust the memory or otherwise crash the server.

Any idea how to do that?

Answer Source

I believe this is what you're looking for:

trigger_error("Oops!", E_USER_ERROR);


E_USER_ERROR is pretty much equal to E_ERROR, which is a fatal runtime error.