How to get the last element of an PHP array $lastValue = array_values(array_slice($spread, -1))[0]; Reference: https://stackoverflow.com/questions/3687358/whats-the-best-way-to-get-the-last-element-of-an-array-without-deleting-it Read More