Forum und email

chr

(PHP 4, PHP 5)

chr — Restituisce un carattere specifico

Descrizione

string chr ( int $ascii )

La funzione restituisce una stringa di un carattere contenente il carattere indicato come codifica ASCII nel parametro ascii .

Example#1 Esempio di uso di chr()

<?php
$str 
"La stringa termina con un escape: ";
$str .= chr(27); /* aggiunge il carattere di escape al termine di $str */

/* Spesso è più pratico */

$str sprintf("The string ends in escape: %c"27);
?>

A questo link » https://www.asciitable.com si può trovare una tavola delle codifiche ASCII.

Questa funzione è complementare rispetto a ord(). Vedere anche sprintf() con la stringa di formato %c.