The end() function in PHP moves the internal array pointer to the last element in the array. However in Ruby, there is no internal array pointer – as such Ruby doesn’t have an equivalent to PHP’s end() function. However Ruby does have the Array::last() method which returns the last element of an array.
$programming = array('java', 'ruby', 'python', 'php'); $language = end($programming); print_r($language); // => php
programming = ['java', 'ruby', 'python', 'php']; language = programming.last; puts language; => # php