fork(1) download
  1. <?php
  2.  
  3. $a = array (array(1,2,3,4,5),array('a','b','c','d'));
  4. $i = 0;
  5. foreach ($a as $b){
  6. //note que a variável $i será impressa apenas uma vez
  7. echo '$i = '.$i++ .PHP_EOL;
  8. foreach ($b as $c){
  9. echo $c.PHP_EOL;
  10. if($c == 3){
  11. break 2;
  12. }
  13. }
  14. }
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
$i = 0
1
2
3