【发布时间】:2012-08-02 07:37:52
【问题描述】:
例如,我有 2 个与每个元素无关的值列表。我打算手动输入这些值。
$a1 = 'red';
$a2 = '007';
$a3 = 'gun';
$a4 = 'apple';
$b1 = 'poison';
$b2 = 'movie';
$b3 = 'man';
$b4 = 'store';
echo $a.' with '.$b
我想要这样的输出:
red with poison
007 with movie
gun with man
apple with store
所以我希望$an 与$bn 一起显示。我曾想过使用for循环,但我不知道该怎么做(我对PHP真的很陌生......)
有什么建议吗?任何帮助都会很棒。提前致谢!
【问题讨论】:
-
为什么不直接使用关联数组?
-
答案可能在于变量变量,但使用数组会干净得多!