English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP String Character String Function Manual
The ord() function is used to return the ASCII value of the first character in the string.
int ord ( string $string )
return the ASCII value of the character.
If the string is ASCII, ISO-8859、Windows 1252and similar single-byte encoding, which is equal to the position of the character in the character set encoding table. But please note that this function will not detect the encoding of the string, especially it will not recognize similar UTF-8 or UTF-16 This is the Unicode code point (code point) of the multi-byte character.
It returns the ASCII value in integer form.
Serial Number | Parameter and Description |
---|---|
1 | string This is a character set |
Try the following example, return the ASCII value of "hi", and the final return value is the ASCII value of the character "h":
<?php //The return value is the ASCII value of the character "h" echo ord("hi")."<br>"; ?>Test and see‹/›
Output Result
104