How to use php ord function?

藏色散人
Release: 2023-02-22 22:24:01
Original
2603 people have browsed it

php The ord function is used to return the ASCII value of "S". Its syntax is ord(string). The parameter string is required and refers to the string from which the ASCII value is to be obtained.

How to use php ord function?

#How to use php ord function?

Definition and Usage

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

Syntax

ord(string)
Copy after login

Parameters

string Required. The string to obtain the ASCII value from.

Return value: Returns the ASCII value as an integer.

PHP Version: 4

Example

Return the ASCII value of "S":

<?php
echo ord("S")."<br>";
echo ord("Shanghai")."<br>";
?>
Copy after login

Output:

83
83
Copy after login

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!