Skip to content

Latest commit

History

History
18 lines (13 loc) · 290 Bytes

File metadata and controls

18 lines (13 loc) · 290 Bytes

ArrayCatch

Catch exceptions of undefined array fields instead of crash.

Usage

set_error_handler('handleError');
$data = [];
try {
echo $data['test'];
} catch (ArrayFieldNotSet $exception) {
echo $exception->getMessage();
}
restore_error_handler();