Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP ord() Function

PHP ord() Function

PHP String Reference Manual PHP String Reference Manual

Example

Return the ASCII value of "h":

"; echo ord("hello")."
"; ?>

Run Example »


Definition and Usage

The ord() function returns the ASCII value of the first character of a string.


Syntax

ord(

string

)

Parameters Description
string Required. The string to get the ASCII value from.

Technical Details

Return Value: Returns the ASCII value as an integer.
PHP Version: 4+

PHP String Reference Manual PHP String Reference Manual