PHP end array function
Last Updated: February 19, 2022
end — Set the internal pointer of an array to its last element
Every array has an internet pointer pointing at the current element.
Syntax
end(array|object &$array): mixed
Supports (PHP 4 , PHP 5, PHP 7, PHP 8)
Parameters
Parameter | Description |
value | target array |
Return Value
Returns the last element of the array
Example
$numbers = array("1","2","3");
end($numbers);
print_r(current($numbers));
Output
3