PHP end() Function

The end() function is used to move the internal pointer of an array to its last element.

The value of the last element of array1.

Value Type : Mixed*.

*Mixed : Mixed indicates multiple (but not necessarily all) types.

Parameter Description
array Required. Specifies the array to use

Syntax

end(array) 

Example

$names=array("Samuel","Lachlan","Alex");
echo current($names) . "
";
echo end($names);

Output

Samuel
Alex

Leave a Reply

Your email address will not be published. Required fields are marked *