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

How to use php chr function

藏色散人
藏色散人Original
2019-01-31 10:12:143239browse

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)

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>"; // 十六进制值
?>

Output:

R
2
B

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!

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