有两个阵列:
First Array:
Array
(
[0] => ACTIVITIES
[1] => 50
[2] => 35
[3] => THIRTY
[4] => FIVE
[5] => PASS
)
第二阵列:
Array
(
[0] => EXTRA CURRICULAR ACTIVITIES
[1] => 50
[2] => 35
[3] => THIRTY
[4] => FIVE
[5] => PASS
)
期望输出:
private void button1_Click(object sender, EventArgs e)
{
DateTime dateTime = DateTime.ParseExact(textBox1.Text, "HH:mm", System.Globalization.CultureInfo.CurrentCulture);
TimeSpan time = new TimeSpan(8,40,0);
DateTime outputTime = dateTime.Add(time);
textBox2.Text = outputTime.ToString("HH:mm");
}
两个数组应该是动态的,我需要先加到第二个,请帮帮我
答案 0 :(得分:1)
您需要implode第一个数组,并将结果添加到第二个数组的第一个值:
$array1 = array('EXTRA', 'CURRICULAR');
$array2 = array('ACTIVITIES', 50, 35, 'THIRTY', 'FIVE', 'PASS');
$string = implode(' ', $array1);
$array2[0] = $string . ' ' . $array2[0];
var_dump($array2);
结果:
array (size=6)
0 => string 'EXTRA CURRICULAR ACTIVITIES' (length=27)
1 => int 50
2 => int 35
3 => string 'THIRTY' (length=6)
4 => string 'FIVE' (length=4)
5 => string 'PASS' (length=4)