CKTIS / PHP
chr()
Produit une chaîne d’un seul octet.
Version : PHP 8.4; repository runtime, production runtime not attested
Syntaxe
chr(int $codepoint): stringProduit une chaîne d’un seul octet. En PHP 8.4 l’entier est réduit modulo 256 et 256 donne l’octet nul. 233 produit un seul octet, différent du codage UTF-8 du point de code Unicode correspondant.
Signature
chr(int $codepoint): string
Sortie de l’exemple
["41","e9","00","ff"]
Exemples
<?php
echo json_encode(array_map(fn($n)=>bin2hex(chr($n)),[65,233,256,-1]));
Résultat
["41","e9","00","ff"]