Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php 8 undefined array key as notice

set_error_handler(function($errno, $error){
    if (!str_starts_with($error, 'Undefined array key')){
        return false;  //default error handler.
    }else{
        trigger_error($error, E_USER_NOTICE);
        return true;
    }
}, E_WARNING);

then 
ini_set ("error_reporting",  E_ALL & ~E_NOTICE & ~E_USER_NOTICE)
Source by exerror.com #
 
PREVIOUS NEXT
Tagged: #php #undefined #array #key #notice
ADD COMMENT
Topic
Name
5+3 =