Home > Backend Development > PHP Tutorial > php获取数组最后一个元素的方法

php获取数组最后一个元素的方法

WBOY
Release: 2016-06-20 13:04:40
Original
1017 people have browsed it

php获取数组最后一个元素的方法

我们可以使用php内置函数end()。end() 函数将数组内部指针指向最后一个元素,并返回该元素的值(如果成功)。

例如:

$args=Array('www','scutephp','com');<br />echo end($args);//com
Copy after login


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template