30 seconds of PHP

  Back to Home

without

arraybeginner

Filters out the elements of an array, that have one of the specified values.

Use array_values() and array_diff() to remove any values in $params from $items.

function without($items, ...$params)
{
  return array_values(array_diff($items, $params));
}