Home  >  Article  >  Backend Development  >  How to use the function end() in PHP to access the last element of an array_PHP Tutorial

How to use the function end() in PHP to access the last element of an array_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:02:41830browse

Usage of the function end() in PHP to access the last element of the array

This article mainly introduces the usage of the function end() in PHP to access the last element of the array, and analyzes PHP with examples The technique of accessing array elements in the end function is very practical. Friends who need it can refer to it

The example in this article describes the usage of the function end() in PHP to access the last element of the 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.

?

1

2

$users = array ("baidu.com", "haosou.com", "sina.com", "jb51.net");

print end($users);

1 2

$users = array ("baidu.com", "haosou.com", "sina.com", "jb51.net");

print end($users);

I hope this article will be helpful to everyone’s PHP programming design. http://www.bkjia.com/PHPjc/969964.htmlwww.bkjia.com
true
http: //www.bkjia.com/PHPjc/969964.html
TechArticleUsage of function end() in php to access the last element of the array. This article mainly introduces the usage of php to access the last element of the array. Function end() usage, example analysis of the end function in php to access array elements...
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