X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP ord() Function

PHP String Reference PHP String Reference

Example

Return the ASCII value of "h":

<?php
echo ord("h")."<br>";
echo ord("hello")."<br>";
?>

Run example »

Definition and Usage

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


Syntax

ord(string)

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 PHP String Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook