PHP ord function is used to convert the first byte of a string to a value between 0-255. The syntax is ord(string), and the parameter string is required and represents the string from which the ASCII value is to be obtained.
#What does the ord function mean? How to use php ord function?
Function: Returns the ASCII value of the first character of the string.
Syntax:
ord(string)
Parameters:
string Required, the string from which the ASCII value is to be obtained
Description: Returns the first character of the string ASCII value.
php ord() function usage example 1:
<?php echo ord("Hello world"); ?>
Output:
72
php ord() function usage example 2:
<?php echo ord("i'm study in php.cn"); ?>
Output:
105
This article is an introduction to the PHP ord function. I hope it will be helpful to friends in need!
The above is the detailed content of How to use php ord function. For more information, please follow other related articles on the PHP Chinese website!