У меня есть существующий массив данных в таком формате:
Array ( [0] => Array ( [employee_id] => 14100001 [salary] => 346.35416666667 [late_duration] => 2 [undertime_duration] => 3 [cola_duration] => 0 [date] => 2019-09-09 )
[1] => Array ( [employee_id] => 14100001 [salary] => 350 [late_duration] => 0 [undertime_duration] => 0 [cola_duration] => 0 [date] => 2019-09-10 )
[2] => Array ( [employee_id] => 14100002 [salary] => 350 [late_duration] => 0 [undertime_duration] => 0 [cola_duration] => 0 [date] => 2019-09-09 )
[3] => Array ( [employee_id] => 14100003 [salary] => 358.75 [late_duration] => 0 [undertime_duration] => 0 [cola_duration] => 2 [date] => 2019-09-09 )
Теперь я хочу вставить данные в существующий массив, чтобы они были такими:
Array ( [0] => Array ( [employee_id] => 14100001 [salary] => 346.35416666667 [late_duration] => 2 [undertime_duration] => 3 [cola_duration] => 0 [date] => 2019-09-09 [calculate_id] => 1 )
[1] => Array ( [employee_id] => 14100001 [salary] => 350 [late_duration] => 0 [undertime_duration] => 0 [cola_duration] => 0 [date] => 2019-09-10 [calculate_id] => 1 )
[2] => Array ( [employee_id] => 14100002 [salary] => 350 [late_duration] => 0 [undertime_duration] => 0 [cola_duration] => 0 [date] => 2019-09-09 [calculate_id] => 1 )
[3] => Array ( [employee_id] => 14100003 [salary] => 358.75 [late_duration] => 0 [undertime_duration] => 0 [cola_duration] => 2 [date] => 2019-09-09 [calculate_id] => 1 )
Вот мой код, и он возвращает ошибку: Попытка присвоить свойство 'calculate_id'
необъекта
$calculate = $this->payroll->record_calculate_date($start_date,$end_date);
foreach ($this->data_array as $key => $value) {
array_push($this->data_array , $this->data_array->calculate_id = $calculate);
}
foreach ($$this->data_array1 as $key => $value) {
array_push($this->data_array , $this->data_array->calculate_id = $calculate);
}