& confusion, mad bug or unexpected behaviour
| From: | waldschrott | Date: | Wed, 07 Jun 2000 23:29:18 +0000 |
| Subject: | & confusion, mad bug or unexpected behaviour | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-20524@lists.php.net to get a copy of this message | ||
1) try this, works as expected:
$pos=array(3=>'a',5=>'b',6=>'c',7=>'d');
$positions=&$pos; // important line
foreach($positions AS $pos1 =>$char1) {
list($pos2,$char2)=each($positions);
echo $pos1.$pos2."<BR>"; }
2) and this, one line modified, does not work as expected, the foreach() seems not to move the cursor, change:
$positions=&$pos; // important line
to
$positions=$pos;
if it´s a bug, it´s a bad one - tested on php4 release
if not I would expect another behaviour
regards
--
o----------0-¬---------O-·---¬----o---®-----o o O ° . | http://www.kiffen.de | pRoteçt y0ur bRaín |0 O ° ¤ ° ·0°·³°²'²³-¹'³´³°^°³~³²³°'³²²¨³²^³¹³²°²³`³º³°Þ ° o © ° . ·
| psychedelic experience | gott@kiffen.de | O ° o °o-¬--o--0-----©-·--O-----o-----0-¤----------o 0 ° · ° . ¤ ·