The end() function is an inbuilt function in PHP and is used to find the last element of the given array. The end() function changes the internal pointer of an array to point to the last element and returns the value of the last element.
Parameters: This function accepts a single parameter $array. It is the array of which the last element we want to find.
Return Value: It returns the value of the last element of the array on success but FALSE on failure i.e, when the array is empty.
Input: array('Ram', 'Shita', 'Geeta') Output: Geeta Explanation: Here input array contain many elements but output is Geeta i.e, last element of the array as the end() function returns the last element of an array.
Below programs illustrate the end() function in PHP:
- What is the difference between Front-End and Back-End Web Development?
- CSS | border-end-end-radius Property
- Removing occurrences of a specific character from end of a string in PHP
- How to remove white spaces only beginning/end of a string using PHP ?
- Express.js res.end() Function
- CSS | grid-row-end Property
- CSS | grid-column-end Property
- Best Books to Learn Front-End Web Development
- Best Books to Learn Back-End Web Development
- CSS | border-block-end-style Property
- Laravel | Front-end Scaffolding
- Node.js | Stream writable.end() Method
- CSS | margin-block-end Property
- CSS | margin-inline-end Property
- Node.js | Readable Stream end Event
- CSS | border-block-end Property
- CSS | border-block-end-width Property
- CSS | border-block-end-color Property
- CSS | border-end-start-radius Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.