[quote="Dm7"]Wowthat'ssobeautiful...:P
Cannot display Chinese What a pety
Rainbows!
Moderator: General Moderators
Cannot display Chinese What a pety[/quote]
I change the code
now it can display Chinese and Enghlish
Example:
中华人民共和国
中华人民共和国RPC中国
I change the code
now it can display Chinese and Enghlish
Code: Select all
<?php
if(!empty($HTTP_POST_VARS['textbox']))
{
$string = $HTTP_POST_VARS['textbox'];
$steps = strlen($string);
$r = 255; $g = 0; $b = 255;
$step = 255 / ceil($steps/5);
echo '<textarea rows="15" name="output" cols="45" style="width:100%">';
$y=0;
for ($x=0;$x<$steps;$x++)
{
if ($y%ceil($steps/5) == 0)
{
$s++;
}
switch ($s)
{
case 1: $b -= $step; break;
case 2: $g += $step; break;
case 3: $r -= $step; break;
case 4: $b += $step; break;
case 5: $g -= $step; break;
}
if(ord(substr($string,$x,1))<0x81)
{
echo "[color=#".sprintf("%02X%02X%02X",$r,$g,$b)."]".$string{$x}."[/color]";
}
else/*if(ord(substr($string,$x,1))>=0x81)*/
{
echo "[color=#".sprintf("%02X%02X%02X",$r,$g,$b)."]".$string{$x}.$string{$x+1}."[/color]";
$x++;
}
$y++;
}
echo '</textarea><br />';
}
?>中华人民共和国
中华人民共和国RPC中国