30 seconds of PHP

  Back to Home

isUpperCase

stringbeginner

Returns true if the given string is upper case, false otherwise.

Convert the given string to upper case, using strtoupper and compare it to the original.

function isUpperCase($string)
{
  return $string === strtoupper($string);
}