Home > Backend Development > PHP Tutorial > How to use php chr function

How to use php chr function

藏色散人
Release: 2023-04-04 22:44:01
Original
3262 people have browsed it

PHP chr function is used to return the specified character, that is, return the character from the specified ASCII value. The syntax is chr(ascii), the parameter ascii is required, that is, the ASCII value is specified.

How to use php chr function

#What does the chr function mean? How to use php chr function?

php chr() function Syntax

Function: Return characters from the specified ASCII value.

Syntax:

chr(ascii)
Copy after login

Parameters:

ascii Required, specify the ASCII value

Description: The 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.

php chr() function usage example:

<?php
echo chr(82) . "<br>"; // 十进制
echo chr(062) . "<br>"; // 八进制值
echo chr(0x42) . "<br>"; // 十六进制值
?>
Copy after login

Output:

R
2
B
Copy after login

This article is an introduction to the PHP chr function. I hope it will help you if you need Friends help!

The above is the detailed content of How to use php chr 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