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

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

WBOY
WBOYOriginal
2016-06-01 11:06:28884browse

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

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

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

上面的代码返回:bitsCN.com

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

Statement:
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