CKTIS / PHP
chr()
Produce a string containing exactly one byte.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
chr(int $codepoint): stringProduce a string containing exactly one byte. In PHP 8.4 integer inputs outside 0–255 wrap modulo 256, so 256 yields a zero byte. The result for 233 is a single byte, not the UTF-8 encoding of the Unicode character with that code point.
Signature
chr(int $codepoint): string
Example output
["41","e9","00","ff"]
Examples
<?php
echo json_encode(array_map(fn($n)=>bin2hex(chr($n)),[65,233,256,-1]));
Result
["41","e9","00","ff"]