I have a basic if-then-else statement to catch an "exception" but I can not do much in case the exception happens so I would like to exit my script at this point with a fatal error. How can I do this? The code is:
if(ksort($hFileList)) $fileList = array_values($hFileList);
else ???
That is: I am duing all I can to ensure my $hFileList is there and looks as it should, but in case something unexpected happens, I would like to produce a standard php fatal error. Shall I simply get rid of the if and let it "crash" instead?
just put a call to phps trigger_error method:
if( true === $errorCase ) {
trigger_error( $yourErrorMessage, E_ERROR );
}
that'll stop your script with a fatal error. see php documentation also:
http://php.net/manual/de/function.trigger-error.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With