how to update an array using a function, php
<p>Hey I have return a function that takes some orders and subtracts them from an array of inventory...however when am running the function it is only updating the inventory within the function and the original inventory doesn't change..I know this is something to do with scope but I don't know how to do it exactly..
How can I do this ? can you help?</p>

<pre><code>function updateInventory ($inv) {
    foreach($_SESSION["inventory"] as $bookDetails) {
        foreach($_POST['orders'] as $k =&gt; $v) {
            if($bookDetails['title'] == $k &amp;&amp; $v == "hardcover") {
                $bookDetails['hc-quantity']=intval($bookDetails['hc-quatinty'])-1;     
            }      
        }
    }
}
</code></pre>