Mutates the original array to filter out the values specified.

Use array_values() and array_diff() to remove the specified values from $items.

代码实现

function pull(&$items, ...$params)
{
  $items = array_values(array_diff($items, $params));
  return $items;
}

使用样例

$items = ['a', 'b', 'c', 'a', 'b', 'c'];
pull($items, 'a', 'c'); // $items will be ['b', 'b']