0
我有點array-ed用這個,我希望有人能幫助我。我有幾個變量,並且在if語句中使用數組時有點困難。每週用php系列計算if語句
我想找出是,如果我的relocation_date是小於notified_time(從生成系列)然後給我old_meter_id其他meter_id
$meter_id = 1393;
$notified_time = '2013-05-01 09:53';
$completed_time = '2013-05-01 11:52';
$relocation_date = '2013-04-24 00:00';
$old_meter_id = 1832;
$notified_time = strtotime($notified_time);
$completed_time = strtotime($completed_time);
$relocation_date = date($relocation_date);
$combined = array();
for($i=0;$i<=10;$i++)
{
$start_series = strtotime("- $i weeks", $notified_time);
$end_series = strtotime("- $i weeks", $completed_time);
$combined[] = array('start_time' => date('d-m-Y H:i:s',$start_series),
'end_time' => date('d-m-Y H:i:s',$end_series),
'relocation' => $relocation_date,
'meter_id' => $meter_id,
'old_meter_id' => $old_meter_id,
);
}
樣品預計輸出是這樣的:
Array
(
[0] => Array
(
[start_time] => 01-05-2013 09:53:00
[end_time] => 01-05-2013 11:52:00
[relocation] => 2013-04-24 00:00
[meter_id] => 1393
)
[1] => Array
(
[start_time] => 24-04-2013 09:53:00
[end_time] => 24-04-2013 11:52:00
[relocation] => 2013-04-24 00:00
[meter_id] => 1832
)
.....
提前致謝!
這也正是它,謝謝@dianuj :) – Glicious
歡迎您:) –