Php 如何计算数组中的公共值

Php 如何计算数组中的公共值,php,arrays,Php,Arrays,我想计算这些数组中的公共值。请指导如何做到这一点 因此,我希望得到以下结果: Array ( [attendance_id] => 18 [attendance] => 1 [student_id] => 1 [date] => 2015-01-19 [in_time] => 00:00:00 [out_time] => 00:00:00 [fe

我想计算这些数组中的公共值。请指导如何做到这一点

因此,我希望得到以下结果:

Array (
        [attendance_id] => 18 
        [attendance] => 1
        [student_id] => 1
        [date] => 2015-01-19
        [in_time] => 00:00:00 
        [out_time] => 00:00:00
        [fee_amount] => 15000 ) 
Array (
        [attendance_id] => 19 
        [attendance] => 1 
        [student_id] => 2
        [date] => 2015-01-19
        [in_time] => 00:00:00
        [out_time] => 00:00:00 
        [fee_amount] => 2000 ) 
Array (
        [attendance_id] => 20 
        [attendance] => 0
        [student_id] => 1
        [date] => 2014-01-15 
        [in_time] => 00:00:00 
        [out_time] => 00:00:00 
        [fee_amount] => 0 
      )

这实际上适用于一个小型学院,在那里,一天的单身学生详细信息可以如上所述输入到系统中。因此,我只想在一天结束时做一个报告,说明有多少学生在特定的一天来上课,有多少没有来。

试试这个。

 date      [2014-01-15 ] => 2
 attendance [1]  => 2

是的,迪娜,让我们说

 Array ( [18] => 2 [2015-01-19] => 2 [15000] => 1 [22] => 2 [20] => 1 [11] => 1 )

$array=array(数组('18',我想这可能不起作用,因为考勤和学生id在数组中都有1作为值arrays@user3696108我已经更新了我的答案。检查一下,让我看看know@onegun我已经更新了我的答案。检查一下,让我知道。谢谢兄弟,它在一定限度内发挥了作用,结果还可以。有没有办法计算当天的结果[2015-01-19]有很多[1]=>?和[2]=>?你想创建这样的阵列吗?
 Array ( [18] => 2 [2015-01-19] => 2 [15000] => 1 [22] => 2 [20] => 1 [11] => 1 )
$array = array(array('18',<==row id no 
       '2015-01-19',<=date
       '1',<=student id>   
       '2'<=present(1),absent(2))),

       array(array('19',<==row id no 
       '2015-01-19',<=date
       '2',<=student id>   
       '1'<=present(1),absent(2))),