ID:          15663
 Updated by:  [EMAIL PROTECTED]
 Reported By: [EMAIL PROTECTED]
 Status:      Assigned
 Bug Type:    Feature/Change Request
 PHP Version: 4.1.1
 Assigned To: derick
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[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."

------------------------------------------------------------------------

[2002-02-21 12:34:00] [EMAIL PROTECTED]

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 this bug report at http://bugs.php.net/?id=15663&edit=1

Reply via email to