30 seconds of PHP

  Back to Home

drop

arraybeginner

Returns a new array with $n elements removed from the left.

Use array_slice() to remove $n elements from the left. Omit the second argument, $n, to only remove one element.

function drop($items, $n = 1)
{
  return array_slice($items, $n);
}