我有一个数组,无法真正缩小打印所有内容的正确方法。
大批:
$month = Array(
"1" => "January",
"2" => "February",
"3" => "March",
"4" => "April",
"5" => "May",
"6" => "June",
"7" => "July",
"8" => "August",
"9" => "September",
"10" => "October",
"11" => "November",
"12" => "December"
);
我试过的:
function monthList() {
require "config.php";
echo '<select name="month" title="Choose A Month">';
foreach ($month as $i => $value) {
echo '<option value="'.the_month_#_here.'">'.$month[$i].'</option>';
}
echo '</select>';
}
哪个可以很好地提取名称,但我将如何提取数组中与其关联的数字?这就是我需要的option value
。