<?php $iterator = new ArrayIterator([1, 2, 3]); $iteratorbis = new ArrayIterator([4, 5, 6]); $callable = function (Iterator $it) { echo $it->current() * 5, PHP_EOL; return true; }; iterator_apply($iterator, $callable, [$iterator]); echo "===", PHP_EOL; iterator_apply($iterator, $callable, [$iteratorbis]); echo "===", PHP_EOL; iterator_apply($iteratorbis, $callable, [$iterator]);
You have javascript disabled. You will not be able to edit any code.