function generate_table($subjects, $completed_subjects) { $output = ''; foreach ($subjects as $subject => $coefficient) { $is_completed = in_array($subject, $completed_subjects); $bg_color = $is_completed ? 'lightgreen' : 'white'; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; } $output .= '
' . $subject . '' . $coefficient . ''; $output .= '
'; $output .= ''; $output .= ''; $output .= ''; $output .= '
'; $output .= '
'; return $output; }

Comments

Popular posts from this blog