ID: 15663 Updated by: [EMAIL PROTECTED] Reported By: greg at mtechsolutions dot ca -Status: Open +Status: Closed Bug Type: Feature/Change Request PHP Version: 4.1.1 New Comment:
PHP5 has support for traversing arrays with objects and getting not a copy but a reference : foreach ($a as &$v) { } Example code : <?php $a = array((object)1, (object)2,(object)3,(object)4); var_dump($a); foreach ($a as &$v) { $v->scalar++; } var_dump($a); ?> Previous Comments: ------------------------------------------------------------------------ [2003-01-25 11:03:19] [EMAIL PROTECTED] Not likely that this will be addressed at all, atleast I won't do it. Derick ------------------------------------------------------------------------ [2002-04-07 16:59:29] vdhome at idas dot cz Can I expect this anytime soon, please? And what is "ZendEngine2" - is it what will be in 4.2.0? I haven't found any information on what will be in 4.2.0. Is it anywhere on the website? Thanks. ------------------------------------------------------------------------ [2002-02-21 20:37:34] [EMAIL PROTECTED] Don't close, it does apply to arrays. ------------------------------------------------------------------------ [2002-02-21 20:21:11] [EMAIL PROTECTED] This bug has been fixed in CVS. ZendEngine2 uses handle for object. ------------------------------------------------------------------------ [2002-02-21 17:20:05] [EMAIL PROTECTED] Objects are bad examples as they will completely change how they behave in ZE2. However, it is true for normal arrays and it's in the TODO list of PHP: "Zend ---- * allow foreach ($array as $k => &$val) syntax. right now we cannot traverse an array without copying each element." ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/15663 -- Edit this bug report at http://bugs.php.net/?id=15663&edit=1