@ginerjmJan 11.2015 — #And - where is $k defined? And - you do realize that this will not permanently update the contents of your array? And - did you read the Manual on the foreach function? Lots of knowledge in there!
@WebtorauthorJan 11.2015 — #I want to redo this code: [code=php] <?php $arr_1["Rembo"] = 24; $arr_1["Rokky"] = 40; foreach ($arr_1 as $k=>&$v) {$v = 100; echo "$k is $v years old<br>";} ?> [/code] into this (but it does not work): [code=php] <?php foreach ($arr_1("Rembo" => 24, "Rokky" => 40) as $k=>&$v) { $v = 100; echo "$k is $v years old<br>";
@ginerjmJan 11.2015 — #You can't update an array that doesn't actually exist. You have to have an array defined outside of the for loop in order to update the results and have them once the loop is done.