You are here

function twig_cycle in Translation template extractor 6.3

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

Cycles over a value.

Parameters

ArrayAccess|array $values An array or an ArrayAccess instance:

int $position The cycle position:

Return value

string The next value in the cycle

1 string reference to 'twig_cycle'
Twig_Extension_Core::getFunctions in vendor/Twig/Extension/Core.php
Returns a list of global functions to add to the existing list.

File

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

Code

function twig_cycle($values, $position) {
  if (!is_array($values) && !$values instanceof ArrayAccess) {
    return $values;
  }
  return $values[$position % count($values)];
}