From:             mazanek at abeo dot cz
Operating system: windows
PHP version:      4.2.3
PHP Bug Type:     Feature/Change Request
Bug description:  Improvement of foreach function(?)

this is old issue #3074 - do you support foreach by reference?

I'm using PHP Version 4.2.2.
Having multidimensional array - $multi_array.
I would like to change the $multi_array from place marked **HERE**

foreach($multi_array AS $multi_key=>$multi_array_item)
{       foreach($multi_array_item["another_array"] AS $key=>$value)
        {       if($value=="asdfg")
                {       **HERE**
                }
                ...
        }
}

I have to do it using:
$multi_array[$multi_key]["another_array"][$key]=$new_value

- - - - - - - - 

It would be nice to use "&" to change the $multi_array:

foreach($multi_array AS $multi_key=>&$multi_array_item)
{       foreach($multi_array_item["another_array"] AS &$value)
        {       if($value=="asdfg")
                {       $value=$new_value;
                        $multi_array_item["value_have_changed"]=true;
                }else
                {       $multi_array_item["value_have_changed"]=false;
                }
                ...
        }
}


Is it possible to implement this to new version of PHP?

Thanks,

Jan Maz�nek
[EMAIL PROTECTED]
-- 
Edit bug report at http://bugs.php.net/?id=22278&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22278&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22278&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22278&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22278&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22278&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22278&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22278&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22278&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22278&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22278&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22278&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22278&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22278&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22278&r=gnused

Reply via email to