|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2003-02-18 11:47 UTC] sniper@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 23:00:01 2025 UTC | 
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 mazanek@abeo.cz