Home > Article > Backend Development > How to use the function end() in PHP to access the last element of an array_PHP Tutorial
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:
Theend() 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); |
true