6
我有一个PHP脚本获取$_POST
来决定返回哪个数组。例如:PHP加入两个变量名称
$n = $_POST['n']; // 1, 2 or 3
$a1 = array ('something', 'something else', 'another thing');
$a2 = array ('something 2', 'something else 2', 'another thing 2');
$a3 = array ('something 3', 'something else 3', 'another thing 3');
现在我想对应于$n
值的阵列,假设"2"
。
我怎么能说echo $a . $n
得到$a2
感谢。
+1:使用数组来存储一系列数组比使用少量变量要好。 – Raptor