foreach

From: Date: Fri, 04 Mar 2005 17:48:26 +0000
Subject: foreach
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969366841@lists.php.net to get a copy of this message
Hi, I think that the fact that foreach doesn't reset an array when it is passed as a global should be clearly stated in the documentation. I've wasted a lot of time before I've realized it! There is also a user contributed note commenting this fact in the foreach page. However, I wonder why it is so. A variable defined outside a function becomes a global, so... why foreach resets globals when used outside a function and it doesn't when used inside? (nervertheless, I love PHP ;-) ) Regards, -- Llorenç Solé Maresme Netcom, S.L. tel +34 93 741 10 47 fax +34 93 741 10 48 email lsole@maresme.net

« previous php.doc (#969366841) next »