<?
function makeList($separator) {
  $counter = 1;

  $makeItem = function ($item) use ($separator, &$counter) {
    return $counter++ . $separator . $item . ;
  };

  return $makeItem() . $makeItem() . $makeItem();
}

echo makeList();
?>