PHP chr() Function

The PHP chr() function is used to generate a single byte string from a number. In another words we can say that it returns a character from specified ASCII value.

Syntax:

ParameterDescriptionRequired/Optional
asciiAn ASCII valueRequired

Example 1

Output:

Your character is :52
By using 'chr()' function your value is: 4

Example 2

Output:

Your character is :42
By using 'chr()' function your value is: *

Example 3

Output:

Your character is :0x52
By using 'chr()' function your value is: R

Example 4

Output:

2 + 2 = 4

Given above program in which the ASCII value of chr(43) is '+' and chr(61) is '=' converted .


Next TopicPHP String