home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / Table_example2.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  541 b   |  25 lines

  1. <?php
  2.  
  3. /*
  4. * This example will output html websafe colors in a table
  5. * using HTML_Table.
  6. */
  7. // $Id: Table_example2.php,v 1.1 2002/10/21 12:57:41 mansion Exp $
  8.  
  9. require_once ('HTML/Table.php');
  10.  
  11. $table = new HTML_Table('width=100%');
  12. $table->setCaption('256 colors table');
  13. $i = $j = 0;
  14. for ($R = 0; $R <= 255; $R += 51) {
  15.     for ($G = 0; $G <= 255; $G += 51) {
  16.         for($B = 0; $B <= 255; $B += 51) {
  17.             $table->setCellAttributes($i, $j, 'bgcolor=#'.sprintf('%02X%02X%02X', $R, $G, $B));
  18.             $j++;
  19.         }
  20.     }
  21.     $i++;
  22.     $j = 0;
  23. }
  24. echo $table->toHtml();
  25. ?>