How to use php ord function

藏色散人
Release: 2023-04-04 22:46:02
Original
4585 people have browsed it

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)
Copy after login

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");
?>
Copy after login

Output:

72
Copy after login

php ord() function usage example 2:

<?php
echo ord("i&#39;m study in php.cn");
?>
Copy after login

Output:

105
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template