How to implement an inventory system for a game?
<p>How would I go about implementing an inventory system for a game in PHP? I've been trying to figure out a way so that items can be dynamically used instead of just sitting in your inventory, e.g. equipping weapons, using potions, teleporting, etc.</p>

<p>The only solution I can come up with is to store PHP code in the database, and fetch it when the item is used, but that doesn't really seem appropriate. Is there a better way to implement this?</p>

<p>To clarify: It's an mmo browser game, and the inventory of each player needs to persist through the game. Having a class for each item (There may be hundreds of items) seems difficult to maintain if any changes were to be made. </p>
