Menu Home

chr

osbo.com | PHP | Functions | chr

Generate a single-byte string from a number

Syntax

chr ( int $bytevalue ) : string

Parameters

bytevalue

An integer between 0 and 255.

Values outside the valid range (0..255) will be bitwise and'ed with 255, which is equivalent to the following algorithm:

while ($bytevalue < 0)
{
    $bytevalue += 256;
}

$bytevalue %= 256;

Return

A single-character string containing the specified byte.

Examples

1

a

2

a

3

a

4

 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

5

escape: 
escape: 

6

🐘

PHP