How to check if letter is upper or lower in PHP?

后端 未结 13 1190
忘了有多久
忘了有多久 2020-12-04 19:12

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?

13条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-04 20:05

    I didn't want numbers and others to be an upper char, so I use:

    if(preg_match('/[A-Z]$/',$char)==true)
    {
       // this must be an upper char
       echo $char
    }
    

提交回复
热议问题