function str2gradient($text,$from='', $to='', $mode="hex")
{
if($mode=="hex")
{
$from = hexdec($from[0].$from[1]).",".hexdec($from[2].$from[3]).",".hexdec($from[4].$from[5]); }
return '';
else
else
else
$output = "";
for ($i=1;$i<=$levels;$i++)
{
for ($ii=0;$ii<4;$ii++)
{
$tmp[$ii] = $from[$ii] - $to[$ii];
$tmp[$ii] = floor($tmp[$ii] / $levels); $rgb[$ii] = $from[$ii] -($tmp[$ii] * $i);
if ($rgb[$ii] > 255) $rgb[$ii] = 255;
$rgb[$ii] = dechex($rgb[$ii]);
if (strlen($rgb[$ii]) < 2) $rgb[$ii] = "0$rgb[$ii]"; }
$output .= "<font color="#".$rgb[0].$rgb[1].$rgb[2]."">" . $text[$i -1 ] . "</font>";
}
return $output."n";
}
echo str2gradient("Привет, я Градиент!", "f11717", "21f117");