<?php
// Test script to verify combined subject display

// Simulate combined Bangla subject data
$combined_bangla = [
    'subject_name' => 'Combined Bangla',
    'cq_marks' => 24.5,
    'mcq_marks' => 12,
    'cq_marks_array' => [25, 24],
    'mcq_marks_array' => [12, 12],
    'full_marks' => 100,
    'pass_marks' => 33
];

// Simulate combined English subject data
$combined_english = [
    'subject_name' => 'Combined English',
    'cq_marks' => 33,
    'mcq_marks' => 0,
    'cq_marks_array' => [35, 31],
    'mcq_marks_array' => [0, 0],
    'full_marks' => 100,
    'pass_marks' => 33
];

// Simulate regular subject data
$regular_subject = [
    'subject_name' => 'গণিত',
    'cq_marks' => 45,
    'mcq_marks' => 35,
    'full_marks' => 100,
    'pass_marks' => 33
];

echo "<h2>Testing Combined Subject Display:</h2>\n";

echo "<h3>Combined Bangla:</h3>\n";
echo "CQ Marks Display: ";
if (isset($combined_bangla['cq_marks_array'])) {
    echo implode(', ', $combined_bangla['cq_marks_array']);
} else {
    echo htmlspecialchars($combined_bangla['cq_marks'] ?: '-');
}
echo "<br>\n";

echo "MCQ Marks Display: ";
if (isset($combined_bangla['mcq_marks_array'])) {
    echo implode(', ', $combined_bangla['mcq_marks_array']);
} else {
    echo htmlspecialchars($combined_bangla['mcq_marks'] ?: '-');
}
echo "<br>\n";

echo "<h3>Combined English:</h3>\n";
echo "CQ Marks Display: ";
if (isset($combined_english['cq_marks_array'])) {
    echo implode(', ', $combined_english['cq_marks_array']);
} else {
    echo htmlspecialchars($combined_english['cq_marks'] ?: '-');
}
echo "<br>\n";

echo "MCQ Marks Display: ";
if (isset($combined_english['mcq_marks_array'])) {
    echo implode(', ', $combined_english['mcq_marks_array']);
} else {
    echo htmlspecialchars($combined_english['mcq_marks'] ?: '-');
}
echo "<br>\n";

echo "<h3>Regular Subject:</h3>\n";
echo "CQ Marks Display: ";
echo htmlspecialchars($regular_subject['cq_marks'] ?: '-');
echo "<br>\n";

echo "MCQ Marks Display: ";
echo htmlspecialchars($regular_subject['mcq_marks'] ?: '-');
echo "<br>\n";

echo "<h3>Verification:</h3>\n";
echo "Combined subjects should show individual marks separated by commas<br>\n";
echo "Regular subjects should show single marks as before<br>\n";
?>