Skip to content

Instantly share code, notes, and snippets.

@gianghl1983
Created May 21, 2018 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gianghl1983/7bac5a2a2d456ebb4108e531a61bf168 to your computer and use it in GitHub Desktop.
Save gianghl1983/7bac5a2a2d456ebb4108e531a61bf168 to your computer and use it in GitHub Desktop.
$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