PHP String chr function

What is chr function and how it is used in string ?

Explanation

The chr function returns one character string containing the character specified by ascii.

Syntax:


chr(ascii)

In the above syntax "ascii" is the value for which the equivalent character is returned, for hexadecimal and octal values can be used with leading "ox","o".

Example :


<?php
echo chr(38)."<br />";
echo chr(046)."<br />";
echo chr(0x26)."<br />";
?>
Result :

&
&
&

In the above chr function example the decimal,octal,hexadecimal values for the ASCII character "&" is provided.

PHP Topics


Ask Questions

Ask Question