Different colors using each font in php
by Prabakaran[ Edit ] 2012-09-04 12:18:39
<?php
function strsplt($thetext,$num)
{
if (!$num)
{
$num=1;
}
$arr=array();
$x=floor(strlen($thetext)/$num);
while ($i<=$x)
{
$y=substr($thetext,$j,$num);
if ($y)
{
array_push($arr,$y);
}
$i++;
$j=$j+$num;
}
return $arr;
}
$str = "Welcome To HioxIndia";
$arr1 = strsplt($str,1);
$arr2 = strsplt($str, 3);
$colArr = Array('red','Orange','darkpink','Green','Blue','Indigo','Violet','Brown','CadetBlue',
'Chartreuse','Crimson','DarkCyan','DarkGoldenRod','DeepPink','Gold','Indigo');
//print_r($arr1);
//print_r($arr2);
foreach($arr1 as $val)
{
$num = rand(0,16);
//echo $num.'<br>';
//for($num=0;$num<8;$num++)
echo '<font color="'.$colArr[$num].'">'.$val.'</font>';
}
?>