[英]php array : how to access the “$key-1” in an associative array?
i got an existing foreach with a set of conditions , i'd like to keep it as it is and add the end date that is the beginning date of the line before + one day 我有一组条件的现有foreach,我想保持原样,并添加结束日期,该日期是该行的开始日期+一天之前
How could i access to the "$line-1" to do: 我如何访问“ $ 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
}
Good enough? 够好了?
$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;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.