"Upper case" can technically be applied to any string of binary data. Programming is not English, there are terms that have slightly different meaning than defined by Meriam-Webster; a "string" is not a segment of rope. As I mentioned above, in just about every language (including PHP) a string with only numbers in it is the same when converted to upper case as it is when converted to lower case-- this means the strings are the same. The conclusion here based on string data alone is that the string can be considered both upper and lower case. To say that it is not "an uppercase string including alpha characters" would be a *different* test, one you can implement yourself:

Code:
; * NOTE: this is not how ctype_upper is implemented, see bottom 
alias is_uppercase {
  return $iif($regex($1-, /[A-Z]/) && !$regex($1-, /[a-z]/), $true, $false)
}


However to maintain congruence and consistency the behaviour of isupper cannot have that specialized "English language" version of the algorithm.

If mIRC said the following:

Code:
//if (5 isupper) ; false


Then we would expect the following to also be false:

Code:
$upper(5) == 5


But we know the above is true.

This would be incongruent, where one test gives one result but the same test written differently gives another.

In short, "x isupper" should be considered shorthand for "$upper(x) == x". I see nothing wrong with having the behaviour defined this way.

I should also point out that the ctype_upper PHP function you keep referencing cannot be applied here:

Code:
ctype_upper("X5"); // returns false


This means that the "ctype_upper" checks that the string is *entirely* alpha characters and nothing else. Do you know what that means?

PHP:
Code:
ctype_upper("HELLO WORLD") // returns false
ctype_upper("HI!!!") // returns false

mIRC:
Code:
if (HELLO WORLD isupper) ; returns true
if (HI!!! isupper) ; returns true


Looks like mIRC is right where PHP is wrong. If mIRC changed its behaviour to PHP's, we would end up with a much larger bug: the fact that you could test more than one word at a time. That would break plenty of scripts.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"