For an array like:
Array1 ( [a] => 1 [b] => 2 [c] => 7 [d] => )
I would like to update certain values if keys with variable match.
For example, I am have two variables (a=0.5 and c=0.25). I may also have one or more than two variables which would need to be added to the array.
In the case where I have two variables (a=0.5 and c=0.25).
Can one update the array by adding the proper variable to its corresponding key in the array?
End result:
Array1 ( [a] => 1.5 [b] => 2 [c] => 7.25 [d] => )
Can't think of a way to add values to original array (be from single array, multidimensional array or variables where the key match). I am a newbie to adding or updating array's key value, and am super stuck at these right now. Trying all kinds of things. Thank you!
PS. I am not playing around with converting the original array to variables, perform the math, then convert back again to single dimensional array, but it will not do since the array may have unique keys every time... hmmm...