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:
that’ll stop your script with a fatal error.
see php documentation also:
http://php.net/manual/de/function.trigger-error.php