Replacing values in the array nvp
<p>I have been trying to replace the values in the array
I'll name this array as $currencies when i print this it looks like.</p>

<pre><code>Array
(
[0] =&gt; Array
    (
        [currencylabel] =&gt; USA, Dollars
        [currencycode] =&gt; USD
        [currencysymbol] =&gt; $
        [curid] =&gt; 1
        [curname] =&gt; curname1
        [check_value] =&gt; 
        [curvalue] =&gt; 0
        [conversionrate] =&gt; 1
        [is_basecurrency] =&gt; 1
    )

[1] =&gt; Array
    (
        [currencylabel] =&gt; India, Rupees
        [currencycode] =&gt; INR
        [currencysymbol] =&gt; ₨
        [curid] =&gt; 2
        [curname] =&gt; curname2
        [check_value] =&gt; 
        [curvalue] =&gt; 0
        [conversionrate] =&gt; 50
        [is_basecurrency] =&gt; 
    )

[2] =&gt; Array
    (
        [currencylabel] =&gt; Zimbabwe Dollars
        [currencycode] =&gt; ZWD
        [currencysymbol] =&gt; Z$
        [curid] =&gt; 3
        [curname] =&gt; curname3
        [check_value] =&gt; 
        [curvalue] =&gt; 0
        [conversionrate] =&gt; 22
        [is_basecurrency] =&gt; 
    )
</code></pre>

<p>)</p>

<p>Here I am having a $conversionRate to which i need to divide the values present in the array $currencies [0] -> Array -> [conversionrate] and replace in the same place in array.
and the same operation for [1] -> Array -> [conversionrate] and so on..
for which my current approach is as follows</p>

<pre><code>$conversionRate = 50;
    foreach ($currencies as $key =&gt; $val) {
        $key['conversionrate'] = $key['conversionrate'] / $conversionRate;
        if($key['conversionrate'] == 1) {
            $key['is_basecurrency'] = 1;
        }  else {
            $key['is_basecurrency'] = '';
        }
    }
    print_r($key);
    die;
</code></pre>

<p>Currently this is not working kindly help</p>
