RE: [PHP] foreach weirdness

From: Date: Mon, 26 Mar 2012 06:39:13 +0000
Subject: RE: [PHP] foreach weirdness
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-317262@lists.php.net to get a copy of this message
Requesting that will at least require a major-release (f.e. PHP 6.0) ... but I would rather request to add a notice or warning to the documentation of references to remind stuff like that. http://www.php.net/manual/en/language.references.php I think this is stuff more people will stumble over ... Bye Simon -- I agree it would be wrong to change php's handling of call by reference in foreach loops because there may be a need to access that reference after completing the loop. I was going to suggest there should be a warning in the manual to unset the reference after the foreach loop is completed, but I see the current online manual has that warning prominently displayed on the foreach page. I had a version of the manual from July last year that didn't have the warning, so I'll update my local manual and make sure I keep it up to date. Lesson learned (both manual and foreach references). Cheers Arno

« previous php.general (#317262) next »