Here is the foreach() part of the code:
foreach ($sorted_fields as $sorted_field) {
if (!in_array($sorted_field, $params)) {
if ($in[$sorted_field]) {
if (is_array($in[$sorted_field])) {
$array_values = implode(', ', $in[$sorted_field]);
$message .= "$sorted_field: $array_values\n";
}
else {
$message .= "$sorted_field: $in[$sorted_field]\n";
}
}
}
}
There might be some spelling mistakes in the code because I writed it, not copiend.