I got an array which I filled initially with date and amount=0. This amount must be shared to a number of people. These people I want to add as additional array fields, so that I get: date | amount | user-1 | user-2 |....| user-n
From another array ($user) I got all user-1 ... user-n
// Startday October 12 2014
// Endday February 28 2015
$sd = 'October 12 2014';
$ed = 'February 28 2015';
$period = new \DatePeriod(
\DateTime::createFromFormat('F d Y', $sd),
new \DateInterval('P1D'),
\DateTime::createFromFormat('F d Y', $ed)->modify('+1 day'));
foreach($period as $date) {
$dd = $date->format('F j, Y');
$pay_day[] = array($dd, 0);
for ($b=1;$b<$amount_users;$b++) {
array_push($pay_day[$line],0);
}
}
I don't know $line. It should be the current one from $pay_day[]