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