PHP Making gradient background color with tables

Making gradient background color with tables

<?
function convert($hex) {
  $p = explode(".", $hex);
  $c = dechex($p[0]);
  $c = "$c" . dechex($p[1]);
  $c = "$c" . dechex($p[2]);
  return "#$c";
}
echo "<TABLE cellSpacing=0 cellPadding=0 width=100%>";
for($i=0 ;$i<=255 ; $i = $i+4) {
  $color = "$i.0.0"; //use "$i.$i.$i" for white-gray colors
  $color = convert($color);
  echo "<TR><TD bgcolor=$color>&nbsp;";
}
echo "</TABLE>";
?>