PHP ord() Function
PHP ord() Function
The ord() function in PHP converts the first byte of a string to a value between 0 and 255. This function interprets the binary value of the first byte of string as an unsigned integer.
Syntax
ord ( string $string )
Parameter
string(required): This parameter represents a character.
Return
This function returns an integer between 0 and 255.
Example 1
Output
The unsigned integer value for 'h': 104 The unsigned integer value for 'hello': 104
Example 2
Output
The unsigned integer value for 'a': 97 The unsigned integer value for 'A': 65
Example 3
Output
The converted unsigned integer VALUE 48 49 50 51 52 53 54