This FR is known :)) Best wishes, Andrey Hristov
----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 21, 2002 7:34 PM Subject: Bug #15663: add foreach reference values > From: [EMAIL PROTECTED] > Operating system: > PHP version: 4.1.1 > PHP Bug Type: Feature/Change Request > Bug description: add foreach reference values > > Just a small request that could be fairly useful. > > Say you have an array of objects, $objects. Right now, doing: > > foreach ($objects as $obj) { > $obj->something(); > } > > will create a copy of each object (using unnecessary memory) and call > something() on the copy, not the actual object (which is bad if it's a > mutator function of that class). > > The best way to do it now is to do: > > foreach (array_keys($objects) as $key) { > $objects[$key]->something(); > } > > but it would be very cool if php had the syntax: > > foreach ($objects as &$obj) > > where it would create $obj as a reference to each object. > > thanks > -- > Edit bug report at http://bugs.php.net/?id=15663&edit=1 > -- > Fixed in CVS: http://bugs.php.net/fix.php?id=15663&r=fixedcvs > Fixed in release: http://bugs.php.net/fix.php?id=15663&r=alreadyfixed > Need backtrace: http://bugs.php.net/fix.php?id=15663&r=needtrace > Try newer version: http://bugs.php.net/fix.php?id=15663&r=oldversion > Not developer issue: http://bugs.php.net/fix.php?id=15663&r=support > Expected behavior: http://bugs.php.net/fix.php?id=15663&r=notwrong > Not enough info: http://bugs.php.net/fix.php?id=15663&r=notenoughinfo > Submitted twice: http://bugs.php.net/fix.php?id=15663&r=submittedtwice > > -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php