title: PHP run a script when a session expires
body: <p>I have a cart application with unique items with qty 1 - I need to deplete the stock qty when a user puts one in the basket to avoid someone else buying it. Problem is, that if they abandon the cart without buying I need to put the item back in stock.</p>
  
  <p>Is there a way I can replenish the stock when the cart session expires?  ie run a script to replace the stock.</p>