I am having two arrays $exam_questions
and $attempted_responses
. I want to compare attempted_responses['question_id'] object to $exam_questions['id'] if they match.
output of both arrays are:
$exam_questions
Array
(
[0] => stdClass Object
(
[id] => 747
[section_id] =>
[text] => What does HTML stand for?
[exam_id] => 83
[date_created] => 2019-11-27 09:41:41
[answered] => 1
)
[1] => stdClass Object
(
[id] => 748
[section_id] =>
[text] => Who is making the Web standards?
[exam_id] => 83
[date_created] => 2019-11-27 09:43:04
[answered] => 1
)
[2] => stdClass Object
(
[id] => 749
[section_id] =>
[text] => What does CSS stand for?
[exam_id] => 83
[date_created] => 2019-11-27 09:43:51
[answered] => 1
)
[3] => stdClass Object
(
[id] => 750
[section_id] =>
[text] => Which is the correct CSS syntax?
[exam_id] => 83
[date_created] => 2019-11-27 09:45:17
[answered] => 1
)
[4] => stdClass Object
(
[id] => 751
[section_id] =>
[text] => How do you insert a comment in a CSS file?
[exam_id] => 83
[date_created] => 2019-11-27 09:46:32
[answered] => 1
)
[5] => stdClass Object
(
[id] => 752
[section_id] =>
[text] => What is the correct HTML for inserting an image?
[exam_id] => 83
[date_created] => 2019-11-27 09:47:56
[answered] => 1
)
[6] => stdClass Object
(
[id] => 753
[section_id] =>
[text] => How can you make a list that lists the items with numbers?
[exam_id] => 83
[date_created] => 2019-11-27 09:48:50
[answered] => 1
)
[7] => stdClass Object
(
[id] => 754
[section_id] =>
[text] => What is the correct HTML for creating a hyperlink?
[exam_id] => 83
[date_created] => 2019-11-27 09:49:45
[answered] => 1
)
)
$attempted_responses
Array
(
[0] => Array
(
[question_id] => 747
[answer_id] => 2641
)
[1] => Array
(
[question_id] => 748
[answer_id] => 2646
)
[2] => Array
(
[question_id] => 749
[answer_id] => 2650
)
[3] => Array
(
[question_id] => 750
[answer_id] => 2654
)
[4] => Array
(
[question_id] => 751
[answer_id] => 2656
)
[5] => Array
(
[question_id] => 752
[answer_id] => 2661
)
[6] => Array
(
[question_id] => 753
[answer_id] => 2663
)
[7] => Array
(
[question_id] => 754
[answer_id] => 2668
)
)