PHP ord() Function
Example
Return ASCII value of "S":
<?php echo ord("S")."<br>"; echo ord("Shanghai")."<br>"; ?>
Definition and Usage
The ord() function returns the ASCII value of the first character of the string.
Syntax
ord(string)
Parameter | Description |
---|---|
string | Required. The string from which to obtain the ASCII value. |
Technical Details
Return Value: | Returns ASCII value as an integer. |
PHP Version: | 4+ |