I am stuck, I can't find any reference to this problem. It shouldn't be happening. The global variable $assignmentInfo
is passed into the function, manipulated, and returned as a different variable.
BUT, the local manipulations within the function are propagated to the global variable, so that the next time the function gets called, $assignmentInfo
has been changed. I want to pass in the same, unchanging version of $assignmentInfo
each time I call the function.
Any suggestions?
function studentScores($submissionInfo, $assignmentInfo){
//********************************** Add submission data to assignment data ****************************************************************************
foreach($assignmentInfo as $assignmentGroup){
foreach($assignmentGroup->assignments as $assignment){
foreach($submissionInfo as $submission){
if(isset($assignment->id) and isset($submission->assignment_id) and $assignment->id == $submission->assignment_id){
if (isset($submission->score)){$assignment->score = $submission->score;}
if (isset($submission->submitted_at)){$assignment->submitted_at = $submission->submitted_at;}
if (isset($submission->workflow_state)){$assignment->workflow_state = $submission->workflow_state;}
break;
}
}
}
}
$studentScores = $assignmentInfo;
return $studentScores;
}
$studentScores = studentScores($submissionInfo->submissions, $assignmentInfo);