30秒学会 PHP 片段 – head
Returns the head of a list.
Use reset()
to return the first item in the array.
代码实现
function head($items)
{
return reset($items);
}
使用样例
head([1, 2, 3]); // 1
分享文章、钻研技术、改变生活!
Returns the head of a list.
Use reset()
to return the first item in the array.
function head($items)
{
return reset($items);
}
head([1, 2, 3]); // 1