ATTENTION CLIENTS:
Most of our staff will be preparing for and attending the AVN Expo. We appreciate your patience between now and when we return on Jan 26.

PHP Template Function: last Print

  • 0

Description:

Returns either true or false based on whether or not a key in an array is the last element.

Common Location:

/cms_admin/phptemplate/<templatefolder>/functions/standard.tpl

Usage:

<?php
  $names = ["Anne", "Beth", "Carol", "Denise"];

  foreach($names as $key => $name)
  {
    echo $name;
    if (!last($sets, $key)) echo ", ";
  }

?>

In this case, a comma will be printed after each name, unless the element is the last name.

Arguments

1) The full array

2) The key of the array.

Output

Anne, Beth, Carol, Denise


Was this answer helpful?

« Back