0

我有一个具有一组条件的现有 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
 }
4

1 回答 1

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;
 }
于 2013-09-24T16:53:24.137 回答