function int2hex($i) { $hex = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F'); $rest = $i % 16; $q = floor($i / 16); if ($rest > 0) { return int2hex($q) . $hex[$rest]; } return ""; }
for ($i = 0; $i <= 16 * $NumOfSicsteen; $i++) { for ($j = 0; $j <= 16 * $NumOfSicsteen; $j++) { $bgc = '#' . int2hex($i * $NotOfSicsteen) . $szColorPrefix . int2hex($j * $NotOfSicsteen); echo '<tr><td bgcolor="' . $bgc . '">' . $bgc . "</td></tr>"; } } echo '</table>'; echo '</td><td>'; // Continue with Field Three (static BLUE 00 :: XX XX 00) $szColorPrefix = '00'; echo '<table border="0" cellpadding="0" cellspacing="0" width="120">'; for ($i = 0; $i <= 16 * $NumOfSicsteen; $i++) { for ($j = 0; $j <= 16 * $NumOfSicsteen; $j++) { $bgc = '#' . int2hex($i * $NotOfSicsteen) . int2hex($j * $NotOfSicsteen) . $szColorPrefix; echo '<tr><td bgcolor="' . $bgc . '">' . $bgc . "</td></tr>"; } } echo '</table>'; echo '</td><td>'; // Continue with Field Four (static BLUE ff :: XX XX ff) $szColorPrefix = 'ff'; echo '<table border="0" cellpadding="0" cellspacing="0" width="120">'; for ($i = 0; $i <= 16 * $NumOfSicsteen; $i++) { for ($j = 0; $j <= 16 * $NumOfSicsteen; $j++) { $bgc = '#' . int2hex($i * $NotOfSicsteen) . int2hex($j * $NotOfSicsteen) . $szColorPrefix; echo '<tr><td bgcolor="' . $bgc . '">' . $bgc . "</td></tr>"; } } echo '</table>'; echo '</td></tr>'; echo '</table>';
function url_decode($text) { if (!strpos($text, "%C3")) { for ($i = 129; $i < 255; $i++) { $in = "%" . int2hex($i); $out = "%C3%" . int2hex($i - 64); $text = str_replace($in, $out, $text); } } return urldecode($text); }