How to Cause an Intentional Error Php

Hello, the topic about getting an intentional error is not so often you look up to but sometimes you need it to make sure the error is handled correctly. Let’s dive into the content directly. 1 trigger_error("Error Triggered!", E_USER_ERROR); DOC Reference 1 2 3 4 5 6 7 <?php try { trigger_error("Error Triggered!", E_USER_ERROR); } catch(Exception $e) { echo 'Message: ' .$e->getMessage(); } Above code will give you an triggered fatal error....

April 7, 2022 · 1 min · Me