PHP ord() Function
Example
Return the ASCII value of "h":
<?php
echo ord("h")."<br>";
echo ord("hello")."<br>";
?>
Try it Yourself »
Definition and Usage
The ord() function returns the ASCII value of the first character of a string.
Syntax
ord(string)
Parameter Values
| Parameter | Description |
|---|---|
| string | Required. The string to get an ASCII value from |
Technical Details
| Return Value: | Returns the ASCII value as an integer |
|---|---|
| PHP Version: | 4+ |
❮ PHP String Reference