You need to turn on error reporting to receive the error. You can do it from code or by modifying php.ini
From code
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
Or find php.ini file in xampp/php directory and modify these line
display_errors=On
error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT
You can choose any other Error Level Constant
You can also check this answer How do I get PHP errors to display?
Edit: You can use set_error_handler function to modify default error behavior. Here is the documentation for this function https://www.php.net/manual/en/function.set-error-handler.php
Here is a example code to make warning fatal 
function myErrorHandler($errno, $errstr, $errfile, $errline)
{
    if (!(error_reporting() & $errno)) {
        // This error code is not included in error_reporting, so let it fall
        // through to the standard PHP error handler
        return false;
    }
    switch ($errno) {
        case E_WARNING: 
        case E_USER_ERROR:
            echo "<b>My ERROR</b> [$errno] $errstr<br />\n";
            echo "  Fatal error on line $errline in file $errfile";
            echo ", PHP ".PHP_VERSION." (".PHP_OS.")<br />\n";
            echo "Aborting...<br />\n";
            exit(1);
            break;
        case E_USER_WARNING:
            echo "<b>My WARNING</b> [$errno] $errstr<br />\n";
            break;
        case E_USER_NOTICE:
            echo "<b>My NOTICE</b> [$errno] $errstr<br />\n";
            break;
        default:
            echo "Unknown error type: [$errno] $errstr<br />\n";
            break;
    }
    /* Don't execute PHP internal error handler */
    return true;
}
error_reporting(E_ALL);
set_error_handler("myErrorHandler");