php ord() function


  Translation results:

abbr.ordained (law, etc.) stipulated; order; ordinary; ordinal sequence

php ord() functionsyntax

Function: Returns the ASCII value of the first character of the string.

Syntax: ord(string)

Parameters:

Parameter Description
stringRequired, the string from which the ASCII value is to be obtained

Description: Returns the ASCII value of the first character of the string.

php ord() functionexample

<?php
echo ord("Hello world");
?>

Run instance»

Click the "Run instance" button to view the online instance

Output:

72
<?php
echo ord("i'm study in php.cn");
?>

Run Instance»

Click the "Run Instance" button to view the online instance

Output:

105

Home

Videos

Q&A