$tasksout['counthours'] = 0; foreach($tasks as $task){ $tasksout[$task->getid()]['task_id'] = $task->getTaskid(); $tasksout[$task->getid()]['username'] = $user->getUsername(); $tasksout[$task->getid()]['userid'] = $task->getUserId(); $tasksout[$task->getid()]['hours'] = $task->gethours(); $tasksout['countperuser'][$task->getUserId()] += $task->gethours(); $tasksout['counthours'] += $task->gethours(); }
notacja która zwraca internala:
Notice: Undefined offset:(tu liczba zależna od [$task->getUserId())
Chodzi o tą linię:
$tasksout['countperuser'][$task->getUserId()] += $task->gethours();
Jak się pozbyć tej notacji i zrobić by banglało?