Mega Code Archive

 
Categories / Php / Functions
 

Display all available background colours

<?php print "<html>"; print "<body>"; print "<h1><center>Background colours</center></h1>"; print "<table border='1' align='center'>"; $pos = 1; $tabcol = 0; $col1 = 0; $col2 = 0; $col3 = 0; $col4 = 0; $col5 = 0; $col6 = 0; $xcolour = "0123456789ABCDEF"; //loop statement(line) while ($col1 + $col2 + $col3 + $col4 +$col5 + $col6 < 90) { if ($tabcol == 0) { print "<tr>"; } $tabcol = $tabcol + 1; $xcellcol = '#'.substr($xcolour,$col1,1).substr($xcolour,$col2,1).substr($xcolour,$col3,1).substr($xcolour,$col4,1).substr($xcolour,$col5,1).substr($xcolour,$col6,1); // print "<td width='10%' bgcolor='$xcellcol'>$xcellcol</td>"; print "<td width='10%' bgcolor='$xcellcol'>"; if ($col1 + $col3 + $col5 < 24) { print "<font color='FFFFFF'>"; } print "$xcellcol</td>"; $col6 = $col6 + 3; if ($col6 >15) { $col5 = $col5 + 3; $col6 = 0; if ($col5 >15) { $col4 = $col4 + 3; $col5 = 0; if ($col4 >15) { $col3 = $col3 + 3; $col4 = 0; if ($col3 >15) { $col2 = $col2 + 3; $col3 = 0; if ($col2 >15) { $col1 = $col1 + 3; $col2 = 0; } } } } } if ($tabcol > 5) { $tabcol = 0; print "</tr>"; } } print "</table>"; print "</body>"; print "</html>"; ?>