我有一个数组,我想根据天数更改车辆价格这里是我的数组想要重写数组,我得到了我得到 $rental_days 的天数,并且基于该总价格相乘,现在我想改变它这样,如果天数为 1、2、3、4,则如果 5、6、7 比最后价格适用,则将收取费用,那么我应该如何根据此条件重写数组(total_price)?
$vehicles[$result['vehicle_id']] = array(
'vehicle_id' => $result['vehicle_id'],
'title' => $result['manufacturer']." ".$result['series'],
'manufacturer' => $result['manufacturer'],
'series' => $result['series'],
'year' => $result['year'],
'class' => $result['class'],
'image' => $image,
'image_thumb' => $image_thumb,
'description' => $description,
'seats' => $vehicle_meta['seats'],
'doors' => $vehicle_meta['doors'],
'conditioning' => $vehicle_meta['conditioning'],
'transmission' => $vehicle_meta['transmission'],
'total_price' => $rc_currency->format($rental_days*$result['rent']),
'daily_price' => $rc_currency->format($result['rent'])
);