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:
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);
The above code returns: jb51.net
I hope this article will be helpful to everyone’s PHP programming design.