Changing one value affects another
<p>Please have a look at the following:</p>

<pre><code>foreach($a_Header['Details'] as $i_Detail =&gt; &amp;$a_Detail)
    {
    echo "{$a_Detail['VEH_TREAD_OFF']}\n";

    // Make a back-up of the value
    $BAK_TREAD_OFF = $a_Detail['VEH_TREAD_OFF'];

    // Copy some data from the saved header
    foreach(array
        (
        'POD_QTYORD',
        'VEH_TREAD_OFF',
        'RPM_SCRM_FIXEDPRICE',
        'RPM_TRM_FIXEDPRICE',
        'RPM_TRM_COSTPERMM',
        'RPM_CTS_CASINGCOST',
        'CHARGE_DESC',
        'Hide',
        ) as $s_Column)
        {
        $a_Header['Details'][$i_Detail][$s_Column] = $a_SavedHeader['Details'][$i_Detail][$s_Column];
        }

    echo "{$a_Detail['VEH_TREAD_OFF']}\n";

    // Now restore our value
    $a_Detail['VEH_TREAD_OFF'] = $BAK_TREAD_OFF;
    }
</code></pre>

<p>You can see that prior to entering the for loop, I have backed up a value which I restore after.</p>

<p>This is because for some reason it is being lost during the loop.</p>

<p>I'm not a PHP guru by any stretch, but this is confusing me no end, as I can't see why modifying one variable would affect another, unless there are wormholes in PHP!</p>

<p>Can someone tell me why this might be happening?</p>

<p>Thanks</p>
