Home > Backend Development > PHP Tutorial > php访问数组最后一个元素的函数end()用法_PHP

php访问数组最后一个元素的函数end()用法_PHP

WBOY
Release: 2016-06-01 11:06:28
Original
917 people have browsed it

本文实例讲述了php访问数组最后一个元素的函数end()用法。分享给大家供大家参考。具体分析如下:

end()函数在PHP中用于检索数组中的最后一个元素。end()函数需要一个数组作为其唯一参数,并返回给定数组最后一个元素的元素值。

$users = array ("baidu.com", "haosou.com", "sina.com", "bitsCN.com");
print end($users);
Copy after login

上面的代码返回:bitsCN.com

希望本文所述对大家的php程序设计有所帮助。

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