How to use chr in PHP

In this article, I will explain how the chr() function can be used in PHP.
  • 1539

chr() function in PHP

  • The chr() function is used to return a character from the specified ASCII value.
  • In  chr() function, Octal values are defined by a leading 0.
  • In  chr() function, hex values are defined by leading 0x.

Syntax

chr(ascii)

Parameter

  • ascii ascii is required parameter. it's represent ASCII value.

Example

The following example show to how the chr() function can be used in PHP.

<html>

<body>

<h3 style="color: darkblue;">chr() function example in PHP</h3>

   <?php

    echo "ASCII value of 78 : ". chr(78)."<br />";

    echo "ASCII value of 052 : ".chr(052)."<br />";

    echo "ASCII value of 0x78 : ".chr(0x78)."<br />";

    ?>

</body>

</html>

 

Output

chrphp.jpg
You may also want to read these related articles here
 
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.