PHP end() Function: Usage & Examples
In PHP, the end() function is used to set the internal pointer of an array to the last element and return its value. The function does not reset the array, so after calling end(), the internal pointer will be pointing to the last element. Here is an example of using the end() function:
$fruits = array('apple', 'banana', 'orange');
echo end($fruits); // 输出: orange
In the above example, the end() function will point the internal pointer of the array $fruits to the last element ‘orange’ and then return the value of that element.