我想将以下php转换为c# [英] i want to convert the following php to c#

查看:36
本文介绍了我想将以下php转换为c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

error_reporting(0);
 
if($_POST)
 
{
// create an array based on chaldean numerology
 
$ar = array('A' => 1,
'B' => 2,
'C' => 3,
'D' => 4,
'E' => 5,
'F' => 8,
'G' => 3,
'H' => 5,
'I' => 1,
'J' => 1,
'K' => 2,
'L' => 3,
'M' => 4,
'N' => 5,
'O' => 7,
'P' => 8,
'Q' => 1,
'R' => 2,
'S' => 3,
'T' => 4,
'U' => 6,
'V' => 6,
'W' => 6,
'X' => 7,
'Y' => 1,
'Z' => 7);
 
//get the value entered by post method
$str = $_POST['str'];
//make it upper case. to avoid messing with small letters.
$str = strtoupper($str);
//find the length of the string entered
$len = strlen($str);
 
//set a temp value to calculate
$numero = 0;
 
//now loop through the string one by one and add the values
for($i=0; $i<$len; $i++)
{
$alpha  = $str[$i];
$numero = $ar[$alpha] + $numero;
}
//print the result
echo "NUMEROLOGY TOTAL IS: ". $numero;
}
 
?>
 
<html>
<body>
<form action="" method="post">
<input type="text" name="str"  value="" />
<input type="submit" value="calculate" />
</form>

推荐答案

_POST)

{
// 创建一个基于数组在chaldean命理学上

_POST) { // create an array based on chaldean numerology


ar = array(' A' => 1,
' B' => 2,
' C' => 3,
' D' => 4,
' E' => 5,
' F' => 8,
' G' => 3,
' H' => 5,
' => 1,
' J' => 1,
' K' => 2,
' L' => 3,
' M' => 4,
' N' => 5,
' O' => 7,
' P' => 8,
' Q' => 1,
' R' => 2,
' S' => 3,
' T' => 4,
' U' => 6,
' V' => 6,
' W' => 6,
' X' => 7,
' Y' => 1,
' Z' => 7);

// 获取post方法输入的值
< span class =code-sdkkeyword>
ar = array('A' => 1, 'B' => 2, 'C' => 3, 'D' => 4, 'E' => 5, 'F' => 8, 'G' => 3, 'H' => 5, 'I' => 1, 'J' => 1, 'K' => 2, 'L' => 3, 'M' => 4, 'N' => 5, 'O' => 7, 'P' => 8, 'Q' => 1, 'R' => 2, 'S' => 3, 'T' => 4, 'U' => 6, 'V' => 6, 'W' => 6, 'X' => 7, 'Y' => 1, 'Z' => 7); //get the value entered by post method


str =
str =


这篇关于我想将以下php转换为c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆