Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$answers = [
['question_id' => 1, 'option' => 'C'],
['question_id' => 2, 'option' => 'A'],
['question_id' => 3, 'option' => 'C'],
['question_id' => 4, 'option' => 'B'],
['question_id' => 5, 'option' => 'C'],
['question_id' => 6, 'option' => 'C'],
['question_id' => 7, 'option' => 'D'],
['question_id' => 8, 'option' => 'D']
];
//B1. Chuyen $answers ve dang 'key' ==> 'value' cho de so sanh
$ket_qua =[];
foreach ($answers as $answer ){
$ketqua[$answer['question_id']] = $answer['option'];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment