note 60862 deleted from function.htmlentities by nlopess
| From: | nlopess@php.net | Date: | Wed, 18 Jan 2006 19:26:22 +0000 |
| Subject: | note 60862 deleted from function.htmlentities by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-102043@lists.php.net to get a copy of this message | ||
Note Submitter: Flávio Tubino - www.flaviotubino.pro.br
----
Sometimes, you may need to print to screen the HTML representation of a character, not only the
character converted to HTML. Then, you need to convert not once, but two times the same character.
Then, (i.e.) the char 38 will not appear like a '&' in the screen, but
'&'.
Below follow the php code to print a complete character table, two-times converted:
<?php
for($i=0;$i<=255;$i++):
$c=chr($i);
$c=htmlentities($c, ENT_QUOTES, 'ISO-8859-1'); //Converte o caracter
$c=htmlentities($c, ENT_QUOTES, 'ISO-8859-1'); //Tem que converter duas vezes pra mostrar
em HTML
print "char ".$i." = ".$c."<br>";
endfor;
?>
Regards,
Flávio Tubino
http://www.flaviotubino.pro.br