I have texts in UTF-8 with diacritic characters also, and would like to check if first letter of this text is upper case or lower case. How to do this?
echo preg_match('~^\p{Lu}~u', $string_data) ? 'Upper' : 'lower';
/** Please check below lines. I have elaborate above code. **/
~ ; start pattern delimiter
^ ; match from the start of the input string
\p{Lu} ; match exactly one uppercase letter (Unicode safe)
~ ; ending pattern delimiter
u ; enable unicode match