You are here

function twig_last in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Twig/Extension/Core.php \twig_last()

Returns the last element of the item.

Parameters

Twig_Environment $env A Twig_Environment instance:

mixed $item A variable:

Return value

mixed The last element of the item

1 string reference to 'twig_last'
Twig_Extension_Core::getFilters in vendor/Twig/Extension/Core.php
Returns a list of filters to add to the existing list.

File

vendor/Twig/Extension/Core.php, line 753

Code

function twig_last(Twig_Environment $env, $item) {
  $elements = twig_slice($env, $item, -1, 1, false);
  return is_string($elements) ? $elements : current($elements);
}