【发布时间】:2020-01-20 20:34:46
【问题描述】:
我有 2 个数组,每个数组有 10 个值。
print_r of var $correct answers 给了我这个输出:
Array (
[0] => 3
[1] => 0
[2] => 2
[3] => 3
[4] => 2
[5] => 2
[6] => 3
[7] => 1
[8] => 3
[9] => 1
)
print_r of var $choosen_answers 给了我这个输出:
Array (
[0] => 2 // different value
[1] => 0
[2] => 1 // different value
[3] => 3
[4] => 2
[5] => 2
[6] => 3
[7] => 1
[8] => 3
[9] => 0 // different value
)
数组中的每个值都对应问题的个数,所以
[0] has the value of question 1
[1] has the value of question 2
[2] has the value of question 3
and so on...
我想要实现:将这些数组相互比较,然后给我一个输出,例如:
Number of wrong answers: 3
Wrong answers:
Question 1
Question 3
Question 10
我怎样才能做到这一点?
【问题讨论】:
-
到目前为止你尝试过什么?你被困在哪里了?
标签: php arrays array-difference