Why will $time = time(); not show anything.
I really do not understand how to correct this?
Warning: Undefined array key 4
Warning: Undefined array key 5
Warning: Undefined array key 6
Warning: Undefined array key 2
Warning: Undefined array key 3
Warning: Undefined array key 1
Deprecated: gmmktime(): Passing null to parameter #1 ($hour) of type int is deprecated
No matter what I do to fix this error it goes away and then comes back!
I did research for days tried everything and when I think it is fixed I get the same error. This is the unmodified version of what I was trying to fix!
isset/array etc
function formatTimestamp($time, $format='', $dateonly='') 
{
    global $datetime, $locale, $userdata, $board_config;
    
    if(empty($format)): 
        if(isset($userdata['user_dateformat']) && !empty($userdata['user_dateformat'])): 
          $format = $userdata['user_dateformat'];
        elseif (isset($board_config['default_dateformat']) && !empty($board_config['default_dateformat'])): 
          $format = $board_config['default_dateformat'];
        else: 
          $format = 'D M d, Y g:i a';
        endif;
    endif;
    if(!empty($dateonly)): 
      $replaces = ['a', 'A', 'B', 'c', 'D', 'g', 'G', 'h', 'H', 'i', 'I', 'O', 'r', 's', 'U', 'Z', ':'];
      $format = str_replace($replaces, '', (string) $format);
    endif;
    if((isset($userdata['user_timezone']) && !empty($userdata['user_timezone'])) && $userdata['user_id'] != 1): 
      $tz = $userdata['user_timezone'];
    elseif (isset($board_config['board_timezone']) && !empty($board_config['board_timezone'])): 
      $tz = $board_config['board_timezone'];
    else: 
      $tz = '10';
    endif;
    setlocale(LC_TIME, $locale);
    if(!is_numeric($time)):
      preg_match('/(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})/', (string) $time, $datetime);
      $time = gmmktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]);
    endif;
    $datetime = FormatDate($format, $time, $tz);
    return $datetime;
}
If all I need for the time string $time = time(); why would it keep showing that error?
 
    