<?php
/**
 * helpers.php
 * Small shared helpers. Required once via auth_init.php so it's
 * available on every payroll page.
 */

if (!function_exists('h')) {
    /**
     * Null-safe htmlspecialchars(). Any DB field that can be NULL
     * (designation, bank details, comments, etc.) should be echoed
     * through this instead of htmlspecialchars() directly -- avoids
     * the "Passing null to parameter #1" deprecation warning on PHP 8.1+.
     */
    function h($value): string
    {
        return htmlspecialchars((string) ($value ?? ''), ENT_QUOTES, 'UTF-8');
    }
}
