我有一套带有一系列条件的现有foreach,我想保持原样并添加结束日期,这是该行开始日期之前+一天
我怎样才能访问“$ line-1”来执行:
foreach($tab as $line){
if the line before with $line[beginning_date] exists
$line[end_date]= the line before with $line[beginning_date] value +1
}
答案 0 :(得分:3)
够好吗?
$theLineBefore = null;
foreach($tab as $line){
if the line before with $line[beginning_date] exists
$line[end_date]= the line before with $line[beginning_date] value +1
$theLineBefore = $line;
}