Example 1 — Get Character Codes
Print the code for a few common characters.
<?php
echo ord("A"), PHP_EOL;
echo ord("a"), PHP_EOL;
echo ord("0"), PHP_EOL; How It Works
- Pass one letter. Capital A has the code 65.
- Lowercase differs. a is 97, which is 32 higher.
- Digits have codes too. The character 0 is 48, not the number 0.
- Read the result. ord always returns an integer.

