array_pop(): Taking out last element of the array
Take out the last element of the array and returns the same. After applying array_pop() total elements of the array reduces by one. All numerical array keys remain same as last element is removed. Literal keys remain same.
Returns the shifted element ( last element ) of the array. Here $input is an array, $output get the value of last element of the array.
Output of above code is here( $output gets the last element Four )
With Literal Keys
Output is here, ( $output gets the first element Grapes)
Using end & currentBy using current() we can get the element to which the present internal pointer is pointing. We can move the pointer to last element by using end.
Output is here.( The last element is changed from Grapes to Apple)
Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
|