There is this function taking the $feedback
argument by reference and modifying it:
private function removeEmptyAnswers(&$feedback)
{
//Do stuff with $feedback
}
I would like to make a copy of $feedback
before it gets changed, to log it:
private function removeEmptyAnswers(&$feedback)
{
$feedbackCopy = $feedback;
//Do stuff with $feedback
MyLog::write(['before' => $feedbackCopy, 'after' => $feedback]);
}
This would be peanuts if $feedback
were passed by value, but it is passed by reference, meaning that my $feedbackCopy
will also get changed.. or not?
Strange enough not to find any solution for this after 30 minutes of googling.
How to make a copy of an array, which is passed by reference?