Tutorialsplane

PHP chr Function


PHP chr function : is used to convert an ASCII number to character.

PHP chr Function Syntax

chr(ascii)

ascii : is ascii value to convert.

Return : Returns Characters

PHP chr() function Example 1

$chr = chr(42);
echo "my character value is : $chr";

Try it »

Note : ord() works as the reverse of the chr() function.

Output of the above Example :

PHP chr() Function

PHP chr() function Example 2

$chr = chr(100);
echo "my character value is : $chr";

Try it »

PHP String Functions