fork download
  1. <?php
  2. $next = 1;
  3.  
  4. for ($i = 1; $i <= 15; $i++){
  5. switch($next){
  6. case 1:
  7. echo "Es " . $i . ", imprime 1\r\n";
  8. $next = 4;
  9. break;
  10. case 4:
  11. echo "Es " . $i . ", imprime 4\r\n";
  12. $next = 0;
  13. break;
  14. case 0:
  15. echo "Es " . $i . ", imprime 0\r\n";
  16. $next = 1;
  17. break;
  18. }
  19. }
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Es 1, imprime 1
Es 2, imprime 4
Es 3, imprime 0
Es 4, imprime 1
Es 5, imprime 4
Es 6, imprime 0
Es 7, imprime 1
Es 8, imprime 4
Es 9, imprime 0
Es 10, imprime 1
Es 11, imprime 4
Es 12, imprime 0
Es 13, imprime 1
Es 14, imprime 4
Es 15, imprime 0