<?php

function exception_error_handler($errno, $errstr, $errfile, $errline ) {
    throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
}
set_error_handler("exception_error_handler");

$arr = [];
try {
	$d = $arr['not_exists'];
} catch(ErrorException $e) {
	echo "Something went wrong...";
}