chr() function in PHP


The chr() function returns the specific characters. It converts an ASCII value to a character.

Syntax

chr(ascii)

Parameters

  • ascii − Specify the ASCII value

Return

The chr() function returns the character of the ASCII value passed.

The following is an example −

Example

Live Demo

<?php
   $val = 50;
   echo chr($val);
?>

The following is the output −

Output

2

Let us see another example −

Example

Live Demo

<?php
   $val = 88;
   echo chr($val);
?>

The following is the output −

Output

X

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 30-Jul-2019

87 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements