Thursday, November 10th, 2005
If you need to print out special characters in PHP you will probably want to get familiar with the built-in chr() function. Here’s some code that will demonstrate the various ASCII character codes available and how to output them to the screen:
<?php
print ‘Copyright (169): ‘ .
chr(169);
print ‘<br />Registered Trademark (174): ‘ .
chr(174);
print ‘<br />Trademark (153): ‘ .
chr(153);
print ‘<br />’;
for($i=1; $i<256; $i++) {
print “$i <b>” . chr($i) . ‘</b> ‘;
}
?>
Working example here.
by TDavid | Permanent Link | Related Entries: How To, Functions
You can follow this entry by subscribing to the comment feed.
You can also leave a response, or trackback from your own site.
Leave a Reply