function php7_regcase($str)
{
if (empty($str))
return '';
$chars = str_split($str);
foreach ($chars as $char) {
if (preg_match("/[A-Za-z]/", $char)) {
$str_upper = mb_strtoupper($char, 'UTF-8');
$str_lower = mb_strtolower($char, 'UTF-8');
$resp[] = "[{$str_upper}{$str_lower}]";
} else {
$resp[] = $char;
}
}
return implode('', $resp);
}