fork download
  1. <?php
  2.  
  3. $arr = array("a" => "apple", "b" => "banana", "c" => "coffee");
  4.  
  5. $counter = 0;
  6. foreach ($arr as $k => $v) {
  7. $counter++;
  8.  
  9. if ($counter === 1) {
  10. echo "Doing thing 1" . PHP_EOL;
  11. } else {
  12. echo "Doing other thing" . PHP_EOL;
  13. }
  14. }
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Doing thing 1
Doing other thing
Doing other thing