array_intersect Inside multidimensional-array

前端 未结 1 2010
被撕碎了的回忆
被撕碎了的回忆 2021-01-24 00:09

i have an multidimensioanl array which can increase based on user input.i want to do array_intersect inside the array to get the common values between the key.

like exam

1条回答
  •  执笔经年
    2021-01-24 00:54

    I copyed you example and for me it works:

     array(
            36,
            51,
            116,
            171,
            215,
            219,
            229,
            247,
            316,
        ),
        'java' => array(
            14,
            16,
            19,
            24,
            25,
            26,
            29,
            31,
            33,
            34,
            35,
            36,
            37,
            40,
            45,
            49,
            51,
        ),
        'ajax' => array(
            91,
            110,
            113,
            172,
        ),
    );
    
    $intersected_array = call_user_func_array('array_intersect',$array);
    
    print_r($intersected_array);
    
    // RESULT: "Array ( ) "
    

    Please copy exactly this code and tell me your output.

    0 讨论(0)
提交回复
热议问题