There no any function available in php to detect string, this technique is used when user type login name with CAPITAL CASE, CameL caSe or Title case, web developer also prevent these type cases of string for user account loginanme because they assigned unique column of username in database, I wanted to use in a project to send warning message to user if user not choose small caps name.
Code example detect small caps from string.
$not_smallcaps = 'MyUsername'; if(strtolower($not_smallcaps)===$not_smallcaps){ //USER ENTERED SMALL CASE STRING } else { //SEND WARNING USER ENTERED NOT SMALL CASE }
Code example detect capital case.
$not_capitalcase = 'not capital case'; if($not_capitalcase===strtoupper($not_capitalcase)){ //HERE IS CAPITAL CASE } else { //HERE IS NOT CAPITAL CASE }