Nazeer Hussain Nazeer Hussain - 3 months ago 9
PHP Question

How to check first character in string is capital

I am trying to check first character in PHP string is capital or not?

So please guide me how i can check first character in string is capital. I am using PHP.

Thanks

Answer

You can use PHP regular expression to identify either first character in string is capital or not?

preg_match("/^[A-Z]/", $str );

Where $str have your string and above expression will return true if first character in string is capital otherwise return false.