Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Php
$x = $items[array_key_last($items)];

Unlike using the end function, this is functional and will not modify the internal pointer. Requires PHP 7.3+ or a polyfill
$x = end($items);
X := Items'Last

X must be declared earlier.

New implementation...