How to convert php ascii code

藏色散人
Release: 2023-03-05 09:44:02
Original
5158 people have browsed it

php ASCII code conversion method: 1. Use the chr function to return characters from the specified ASCII value; 2. Use the ord function to return the ASCII value of the first character in the string.

How to convert php ascii code

Recommended: "PHP Video Tutorial"

PHP Conversion between ASCII codes and characters

ASCII code conversion character:


string 'A' (length=1)
Copy after login

chr() function returns characters from the specified ASCII value.

ASCII values ​​can be specified as decimal, octal, or hexadecimal values. Octal values ​​are defined with leading 0, and hexadecimal values ​​are defined with leading 0x.

Character conversion to ASCII code:


int 65
Copy after login

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

The above is the detailed content of How to convert php ascii code. 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!