Gold.t

From TORI
Jump to navigation Jump to search

gold.t is PHP program that shows similarities of the 3 canjis used to denote gold, Au.

Code

<?php 
include "uni.t";

$a =unichr(0x2fa6); // echo "$a\n";
$a.=unichr(0x91d1); // echo "$a\n";
$a.=unichr(0xf90a);echo "$a\n";

$N=strlen($a);
echo "The array has $N bytes; here is its splitting:\n";

for($n=0;$n<$N;$n++)
{
printf("%02x ",ord($a[$n]) );
}
echo "\n";

$b = mb_str_split($a);

var_dump($b);
$M=count($b);

#mb_internal_encoding("UTF-8");

for($m=0;$m<$M;$m++)
{
printf("\n");
$c=$b[$m];
$u=uniord($c);
printf("Unicode character number %05d id est, [[X%04X]]\n",$u,$u);
$d=strlen($c);
echo "Picture: [[$c]];  uses $d bytes. These bytes are:\n";
for($n=0;$n<$d;$n++) printf("x%2X ",ord($c[$n]));
printf("in the hexadecimal representation and\n");
for($n=0;$n<$d;$n++) printf("%3d ",ord($c[$n]));
printf("in the decimal representation\n");
}
?>

File uni.t should be also loaded in order to execute command

php gold.t

Output

⾦金金
The array has 9 bytes; here is its splitting:
e2 be a6 e9 87 91 ef a4 8a
array(3) {
  [0]=>
  string(3) "⾦"
  [1]=>
  string(3) "金"
  [2]=>
  string(3) "金"
}

Unicode character number 12198 id est, X2FA6
Picture: ; uses 3 bytes. These bytes are:
xE2 xBE xA6 in the hexadecimal representation and
226 190 166 in the decimal representation

Unicode character number 37329 id est, X91D1
Picture: ; uses 3 bytes. These bytes are:
xE9 x87 x91 in the hexadecimal representation and
233 135 145 in the decimal representation

Unicode character number 63754 id est, XF90A
Picture: ; uses 3 bytes. These bytes are:
xEF xA4 x8A in the hexadecimal representation and
239 164 138 in the decimal representation

References


Keywords

Au, Chinese, Japanese, Kanji, KanjiLiberal, KanjiRadical, PHP, SomeU, Unicode, uni.t, X2FA6, X91D1, XF90A, , ,