I have written the function below. It converts lower caser to upper case and proper case. I want it to ignore foreign characters. eg. ñ
Expected result: Sabiña/Cerca
Actual Result: SabiÑA/Cerca
NOTE: if I use mb_convert_case alone it does not change any character after/ to proper case.
$string= 'SABIÑA CERCA';
echo preg_replace_callback('/\w+/i',
create_function('$m','
var_dump($m);
if(strlen($m[0]) > 3)
{
return mb_convert_case($m[0], MB_CASE_TITLE, "UTF-8");
}
else
{
return ucfirst($m[0]);
}')
, $string);