请输入您的姓名,以计算您的姓名打分。
您的姓名打分:$score";
echo "";
echo "";
foreach ($score as $key => $value) {
echo "";
}
echo "
格
|
数
|
解析
|
$key
|
$value
|
" . getInterpretation($value) . "
|
";
}
function calculateScore($name) {
$name = mb_convert_encoding($name, 'UTF-8', 'GBK');
$pinyin = mb_convert_encoding($name, 'pinyin', 'UTF-8');
$strokes = array();
for ($i = 0; $i < mb_strlen($name); $i++) {
$strokes[] = getStrokeCount(mb_substr($name, $i, 1));
}
$score = array(
'天格' => $strokes[0] + 10,
'人格' => $strokes[1] + $strokes[2],
'地格' => $strokes[2] + $strokes[3],
'外格' => $strokes[0] + $strokes[3],
'总格' => array_sum($strokes) + 10
);
return $score;
}
function getInterpretation($score) {
switch ($score) {
case 18:
return '权威显达,博得名利,且养柔德,功成名就。';
case 22:
return '秋草逢霜,困难疾弱,虽出豪杰,人生波折。';
case 13:
return '才艺多能,智谋奇略,忍柔当事,鸣奏大功。';
case 30:
return '沉浮不定,凶吉难变,若明若暗,大成大败。';
case 9:
return '大成之数,蕴涵凶险,或成或败,难以把握。';
default:
return '无解释。';
}
}
function getStrokeCount($character) {
$strokeCount = array();
$strokeCount['一'] = 1;
$strokeCount['丨'] = 1;
$strokeCount['丿'] = 1;
$strokeCount['丶'] = 1;
$strokeCount['乙'] = 2;
$strokeCount['亅'] = 2;
$strokeCount['二'] = 2;
$strokeCount['亠'] = 2;
$strokeCount['人'] = 2;
$strokeCount['儿'] = 2;
$strokeCount['入'] = 2;
$strokeCount['八'] = 2;
$strokeCount['几'] = 2;
$strokeCount['也'] = 2;
$strokeCount['三'] = 3;
$strokeCount['干'] = 3;
$strokeCount['开'] = 3;
$strokeCount['山'] = 3;
$strokeCount['川'] = 3;
$strokeCount['工'] =3;
$strokeCount['下'] = 3;
$strokeCount['己'] = 3;
$strokeCount['巾'] = 3;
$strokeCount['干'] = 3;
$strokeCount['幺'] = 3;
$strokeCount['广'] = 3;
$strokeCount['不'] = 3;
$strokeCount['十'] = 3;
$strokeCount['卜'] = 4;
$strokeCount['主'] = 4;
$strokeCount['于'] = 4;
$strokeCount['亏'] = 4;
$strokeCount['专'] = 4;
$strokeCount['且'] = 4;
$strokeCount['世'] = 4;
$strokeCount['丘'] = 4;
$strokeCount['业'] = 4;
$strokeCount['东'] = 4;
$strokeCount['丝'] = 4;
$strokeCount['弟'] = 4;
$strokeCount['冷'] = 4;
$strokeCount['条'] = 4;
$strokeCount['为'] = 4;
$strokeCount['母'] = 4;
$strokeCount['比'] = 4;
$strokeCount['毛'] = 4;
$strokeCount['氏'] = 4;
$strokeCount['气'] = 4;
$strokeCount['水'] = 4;
$strokeCount['火'] = 4;
$strokeCount['爪'] = 4;
$strokeCount['父'] = 4;
$strokeCount['片'] = 4;
$strokeCount['皮'] = 4;
$strokeCount['皿'] = 4;
$strokeCount['目'] = 4;
$strokeCount['牙'] = 4;
$strokeCount['瓦'] = 4;
$strokeCount['官'] = 4;
$strokeCount['习'] = 4;
$strokeCount['穴'] = 4;
$strokeCount['立'] = 4;
$strokeCount['竹'] = 4;
$strokeCount['登'] = 4;
$strokeCount['米'] = 4;
$strokeCount['禾'] = 4;
$strokeCount['页'] = 4;
$strokeCount['欠'] = 4;
$strokeCount['田'] = 4;
$strokeCount['由'] = 4;
$strokeCount['甲'] = 4;
$strokeCount['申'] = 4;
$strokeCount['电'] = 4;
$strokeCount['男'] = 4;
$strokeCount['画'] = 4;
$strokeCount['日'] = 4;
$strokeCount['早'] = 4;
$strokeCount['木'] = 4;
$strokeCount['术'] = 4