Home  >  Article  >  Backend Development  >  How to use php ord function

How to use php ord function

藏色散人
藏色散人Original
2019-01-31 10:19:024484browse

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.

How to use php ord function

#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&#39;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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn