array_intersect() with dynamic length of arguments

后端 未结 2 1303
名媛妹妹
名媛妹妹 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 09:15

    You can take advantage of modern PHP's array packing/unpacking features - aka variadics, or the so-called "splat" (...) operator - as well:

    $result = array_intersect(...$strict);
    

提交回复
热议问题