 |
|
Code (PHP)
$str = '0123456789';
function mixTextColor($text, $length) {
$colors = array('Bisque', 'Brown', 'Chartreuse', 'Chocolate', 'Coral', 'YellowGreen');
$result = substr(str_shuffle($text), 0, $length);
for($i = 0; $i < $length; $i++) {
echo '<font color="', $colors[array_rand($colors)] ,'">', $result[$i] ,'</font>';
}
}
mixTextColor($str, 4);
หากต้องการสีไหนเพิ่มใส่ลงไปที่ตัวแปร colors เลยครับ
อ้างอิงสีมาจาก http://www.w3schools.com/css/css_colornames.asp
|
ประวัติการแก้ไข 2011-05-25 10:09:25
 |
 |
 |
 |
Date :
2011-05-25 10:08:31 |
By :
TheBusTeD |
|
 |
 |
 |
 |
|
|
 |