【发布时间】:2014-12-29 17:22:18
【问题描述】:
我的目标是根据 for 循环的值制作 ant assoc 数组。
//$from_time value is 6 and $to_time value is 23
for ($i = $from_time; $i <= $to_time; $i++) {
$working_time_array[] = $i;
}
echo json_encode($working_time_array);
我在 AJAX 成功时得到的输出,当我 console.log 时,我得到这样的结果:
["6",7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]
首选结果是
["6","7","8","9","10"]... etc
【问题讨论】:
标签: php arrays string integer associative-array