PHP static variable not working
<p>In my file adapter.php I have following code:</p>

<p>case 'buyCard':</p>

<pre><code>        static $order=array();
        $id=$_POST['id'];
        $quantity=$_POST['quantity'];
        $price=$_POST['price']; //var_dump($price);
        $order['id']=$id; $order['quantity']=$quantity; $order['price']=$price;

        static $i=0;

        $_SESSION[$i]=$order; $i++; var_dump($i);

        break;
</code></pre>

<p>where informations like id, price and quantity comes from ajax placed in card.php file and it's activated 'onclick'. I need a counter, which will help me to store data in session every time user click on button that trigers this event. But my counter 'static $i' that is supposed to work as index is not incrementing, and I have no idea why? And if there is some other solution to this problem I'm glad to hear it.</p>