← All built-ins / ord()

ord()

ord(string $s): int

Parameters

NameTypeDescription
$sstringstring; only the first byte is used

Return value

Byte value (0–255) of the first character.

Example

echo ord("A"), "
";
echo ord("a"), "
";
65
97

See also

chr()bin2hex()