![]() |
change the value of the array - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: change the value of the array (/showthread.php?tid=73579) |
change the value of the array - DELE - 05-11-2019 My Array : PHP Code: Array I want to change the value of each income_country: PHP Code: foreach ($data as $key => $value) Results : PHP Code: Array why is the result always added to each array? RE: change the value of the array - InsiteFX - 05-12-2019 You need to add it inside of the foreach loop. RE: change the value of the array - DELE - 05-12-2019 (05-12-2019, 03:43 AM)InsiteFX Wrote: You need to add it inside of the foreach loop. what do I mean I don't understand, I add it in the foreach loop right? RE: change the value of the array - DELE - 05-12-2019 (05-12-2019, 03:43 AM)InsiteFX Wrote: You need to add it inside of the foreach loop. I tried to turn back but still failed. please enlighten. RE: change the value of the array - InsiteFX - 05-13-2019 Sorry missed your first foreach, do a var_dump() of your arrays to see what is being inserted. RE: change the value of the array - Wouter60 - 05-13-2019 The $z array is being preserved in the foreach loop. Change it to this: PHP Code: foreach ($data as $key => $value) RE: change the value of the array - DELE - 05-14-2019 (05-13-2019, 11:20 AM)Wouter60 Wrote: The $z array is being preserved in the foreach loop. Change it to this: this works thank you very much |