Re: & confusion, mad bug or unexpected behaviour
| From: | waldschrott | Date: | Thu, 08 Jun 2000 00:56:07 +0000 |
| Subject: | Re: & confusion, mad bug or unexpected behaviour | ||
| References: | 1 2 3 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-20528@lists.php.net to get a copy of this message | ||
BTW, to make foreach() work as intended I had to insert the commented line, *why does it work* regarding that the following line does not work...
$pos=&array(3=>'a',5=>'b',6=>'c',7=>'d'); // does not work, as expected
<?php
$pos=array(3=>'a',5=>'b',6=>'c',7=>'d');
$pos=&$pos; // works, as not expected
foreach($pos AS $pos1 =>$char1) {
list($pos2,$char2)=each($pos);
list($pos2,$char2)=each($pos);
echo $pos1.$pos2."<BR>"; }
?>
is there an invisible layer the array has been copied to to enable referencing?
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 ° · ° . ¤ ·