记录一段代码(把数组分为每天两个)

$sql = "SELECT brand_id, brand_name FROM " . $GLOBALS['ecs']->table('brand') . " ORDER BY brand_id ASC";
	$brand_arr = $GLOBALS['db']->getAll($sql);
	$start = local_mktime(0, 0 , 0, 11, 26, 2010);  // 开始的日期
	$i = 1;
	$now = gmtime();            //当前时间
	foreach ($brand_arr as $key=>$val) {
		$brand_arr[$key]['date'] = $start;
		if ($i < 2) {  // 一天执行两个品牌
			$i++;
		} else {
			$i = 1;
			$start += 86400;
		}
	}
	foreach ($brand_arr as $key=>$val) {  // 找出今天要更新品牌
		if (($val['date'] < $now) && ($val['date'] > $now - 86400)) {
			$update_arr[] = $val;
		}
	}