fork(1) download
  1. <?php
  2. $itemsToProcess = array(1,2,3);
  3.  
  4. foreach ($itemsToProcess as &$item) {
  5. if ($item == 2) {
  6. // processing of item 2 produces 2 new items that should be processed:
  7. $itemsToProcess[] = 7;
  8. $itemsToProcess[] = 8;
  9. continue;
  10. }
  11. echo $item;
  12. }
  13.  
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
1378