PHP chr() work: Here, we will find out about the chr() work with the example in PHP.
PHP chr() work
chr() work is utilized to get the character from a given ASCII code. ASCII value can be in decimal organization, octal configuration by following 0 (zero), and hexadecimal arrangement by following 0x.
Syntax:
chr(ASCII_value);
Capacity acknowledges ASCII value in number and returns relating character.
Example:
Input: 65
Output: 'A'
Input: 0x41
Output: 'A'
PHP Code:
<?php
echo (chr(65)."\n"); //ASCII value of 'A' in decimal
echo (chr(0101)."\n"); //ASCII value of 'A' in octal
echo (chr(0x41)."\n"); //ASCII value of 'A' in hex
?>
Output:
A
A
A
1 thought on “PHP chr() function with example”