Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Guildorn Tanaleth

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

Unicode chart

This PHP-enhanced HTML page will display the first 4,096 (unless you change it) Unicode characters in a neat table. Your browser's ability to render the characters properly may vary.
<HTML>
<HEAD>
<TITLE>Unicode Chart</TITLE>
<LINK REL="Stylesheet" TYPE="text/css" HREF="styles.css">
<STYLE TYPE="text/css">
TH {text-align: center; }
TD {text-align: center; }
</STYLE>
</HEAD>
<BODY>
<TABLE ALIGN=CENTER BORDER=1>
<TR><TH> </TH><TH>0</TH><TH>1</TH><TH>2</TH><TH>3</TH><TH>4</TH><TH>5</TH><TH>6</TH><TH>7</TH><TH>8</TH><TH>9</TH><TH>A</TH><TH>B</TH><TH>C</TH><TH>D</TH><TH>E</TH><TH>F</TH></TR>
<?PHP
 for ($i=0; $i<256; $i++) { //DON'T try to generate the whole chart
  printf('<TR><TD>%04X</TD>', $i);
  for ($j=0; $j<16; $j++) {
   printf('<TD>&#x%X%X;</TD>', $i, $j);
  }
  echo "</TR>\n";
 }
?>
</TABLE>
</BODY>
</HTML>

Image aggregator

This PHP snippet outputs the contents of a table (beginning & ending tags not included) containing all the images from the current directory.
<?PHP
 $columns = 3;
 $im = glob("*.{gif,jpg,png}", GLOB_BRACE);
 $rows = ceil(count($im) / $columns);
 for ($i = 0; $i < $rows; $i++) {
  echo "\n<TR>";
  for ($j = $columns*$i; isset($im[$j]) && $j - $columns*$i < $columns; $j++) {
   echo "<TD>$im[$j]<BR><IMG SRC='$im[$j]'></TD>";
  }
  echo "</TR>";
 }
?>
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS