How to use the function end() in php to access the last element of the array, array end_PHP tutorial

WBOY
Release: 2016-07-13 10:02:59
Original
987 people have browsed it

How to use the function end() in PHP to access the last element of an array, array end

The example in this article describes the usage of the function end() in PHP to access the last element of an array. Share it with everyone for your reference. The specific analysis is as follows:

The

end() function is used in PHP to retrieve the last element in an array. The end() function requires an array as its only argument and returns the element value of the last element of the given array.

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

The above code returns: jb51.net

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/969482.htmlTechArticleUsage of function end() in php to access the last element of the array, array end This article describes the example of php accessing the last element of the array Function end() usage of elements. Share it with everyone for your reference. Specifically...
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