function tag_escape($arr)
{
    if (is_array($arr)) {
        return array_map('tag_escape', $arr);
    }
    return htmlspecialchars($arr);
}