Loading...
PHP/MySQL | Массив
Здравствуйте) И снова я к вам с массивами) Вот такая ошибка:
Notice: Undefined offset: 3 in /var/www/login/data/www/site.su/sys/system.php on line 139

139 строка:

$tmp[$ii] = $from[$ii] - $to[$ii];

Весь код:


function gradient($text,$from='', $to='', $mode="hex")
{

$text = iconv("UTF-8", "windows-1251", $text);


if($mode=="hex")
{

$to = hexdec($to[0].$to[1]).",".hexdec($to[2].$to[3]).",".hexdec($to[4].$to[5]);

$from = hexdec($from[0].$from[1]).",".hexdec($from[2].$from[3]).",".hexdec($from[4].$from[5]);

}

if(empty($text))

return '';

else

$levels=strlen($text);

if(empty($from))

$from = array(0,0,255);

else

$from = explode(",", $from);

if (empty($to))

$to = array(255,0,0);

else

$to = explode(",", $to);

$output = "";

for ($i=1;$i<=$levels;$i++)
{

for ($ii=0;$ii<4;$ii++)
{

$tmp[$ii] = $from[$ii] - $to[$ii]; //139 строка

$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]);

$rgb[$ii] = strtoupper($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 iconv("windows-1251", "UTF-8", $output);

}






Вопрос: Что этой падле не хватает?
________
посл. ред. 06.06.2017 в 08:51; всего 2 раз(а); by Bananas
Онлайн: 3
Время:
Gen. 0.0718
(c) Bym.Guru 2010-2025