note 60862 added to function.htmlentities

From: Date: Wed, 18 Jan 2006 17:50:06 +0000
Subject: note 60862 added to function.htmlentities
Groups: php.notes 
Request: Send a blank email to php-notes+get-102036@lists.php.net to get a copy of this message
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 '&amp;'. 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 ---- Server IP: 200.185.109.101Probable Submitter: 200.180.79.108 ---- Manual Page -- http://www.php.net/manual/en/function.htmlentities.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60862 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60862&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60862&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60862&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60862&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60862&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60862&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60862&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60862&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102036) next »