<?php $ait = new ArrayIterator(array('Value 1', 'Value 2', 'Value 3', 'Value 4')); $cit = new CachingIterator($ait); foreach ($cit as $value) { echo $value; //if has a next value, print a comma if ($cit->hasNext() && $cit->hasNext()) { echo ', '; } }
You have javascript disabled. You will not be able to edit any code.