0

How do I set an alternator to its inicial position?

Code:

foreach($items as $item):
        foreach($sides as $side):
            echo alternator('Left', 'Right');
        endforeach;
        //I want the alternator to "restart" here and always start from the initial variable "Left" in this case
endforeach;
rafaelmorais
  • 1,323
  • 2
  • 24
  • 49

1 Answers1

1

Note: To use multiple separate calls to this function simply call the function with no arguments to re-initialize.

foreach($items as $item):
        foreach($sides as $side):
            echo alternator('Left', 'Right');
        endforeach;
        alternator();
endforeach;
sjagr
  • 15,983
  • 5
  • 40
  • 67