PHP ord () function
Examples
Returns "h" of the ASCII values:
<?php
echo ord("h")."<br>";
echo ord("hello")."<br>";
?>
echo ord("h")."<br>";
echo ord("hello")."<br>";
?>
Running instance »
Definition and Usage
ord () function returns a string in the first ASCII value of the character.
grammar
ord( string )
参数 | 描述 |
---|---|
string | 必需。要从中获得 ASCII 值的字符串。 |
technical details
return value: | Returns integer ASCII value. |
---|---|
PHP version: | 4+ |
PHP String Reference