7.3 Upper- and Lowercase
On the web, it is very difficult to control how a user enters a certain text into a form field. One of the most important problems is the distinction between upper- and lowercase.
Characters—that is, letters, numbers, and special characters—can be represented by ASCII codes (see ). The ASCII codes of the letters are also relevant for the string comparison.[ 53 ] Uppercase letters have different (lower-numbered) ASCII codes than lowercase letters.
To convert uppercase to lowercase and vice versa, you could filter the ASCII codes. The ord(String) PHP function returns the ASCII code of a letter; char(Ascii) is the counterpart and turns an ASCII code into the corresponding string. However, this work has already been ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access