Returns all elements in an array except for the first one.

Use array_slice() and count() to return all the items in the array except for the first one.

代码实现

function tail($items)
{
  return count($items) > 1 ? array_slice($items, 1) : $items;
}

使用样例

tail([1, 2, 3]); // [2, 3]