array_intersect() with dynamic length of arguments

后端 未结 2 1306
名媛妹妹
名媛妹妹 2020-12-11 08:18

I\'ve got an array of arrays that may have a different count of elements when the script is run.

$strict = [
    [0] => [\'one\', \'two\', \'three\', \'f         


        
2条回答
  •  再見小時候
    2020-12-11 08:56

    You can use call_user_func_array:

    Call a callback with an array of parameters

    So your callback would be array_intersect, and you could pass your array like this:

    $result = call_user_func_array('array_intersect', $strict);
    

提交回复
热议问题