note 54099 rejected from control-structures.while by nlopess

From: Date: Thu, 23 Jun 2005 16:21:13 +0000
Subject: note 54099 rejected from control-structures.while by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-90848@lists.php.net to get a copy of this message
Note Submitter: Bruno at Medina dot com dot br ---- Watch this: <? $arr = array(1,2,3); $arr2 = array_fill(0,85,"Casa"); while(list($k, $v) = each($arr)){ while(list($k2, $v2) = each($arr2)){ if($k2 == 84){ //break 2 will be executed break 2; } } break; } echo $v2; //expected value "Casa" is OK ?> but in this case... <? $arr = array(1,2,3); $arr2 = array_fill(0,85,"Casa"); while(list($k, $v) = each($arr)){ while(list($k2, $v2) = each($arr2)){ if($k2 == 90){ //break 2 will not be executed break 2; } } break; } echo $v2; //expected value "Casa" is NULL (why??) ?> ...to make this work... <? $arr = array(1,2,3); $arr2 = array_fill(0,85,"Casa"); while(list($k, $v) = each($arr)){ while(list($k2, $v2) = each($arr2)){ if($k2 == 90){ //break 2 will not be executed break 2; } else { //but... $aux = $v2; } } break; } echo $v2; //still NULL echo $aux; //print Casa as expected in $v2 ?> This is a bug???

« previous php.notes (#90848) next »