note 24973 deleted from control-structures.foreach by jmcastagnetto
| From: | jmcastagnetto@php.net | Date: | Fri, 06 Sep 2002 22:53:45 +0000 |
| Subject: | note 24973 deleted from control-structures.foreach by jmcastagnetto | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-36275@lists.php.net to get a copy of this message | ||
It seams that foreach compute len of the array at the begining of the loop.
------------------------------
foreach($tab as $item){
echo "$item:";
if($item=="b"){
$tab[2]="-";
$tab[]="d";
}
for($i=0;$i<=4;$i++)echo $tab[$i].",";
echo "\n";
}
---------OUTPUT----------------
a: a , b , c
b: a , b , - , d
c: a , b , - , d
-------------------------------
It doesn't do the loop for "d" ...
too bad :-(