title: PHP - count my quantity item in session array
body: <p>How to count the <code>item-qty</code> and current code :-</p>
  
  <pre><code>$q = $_POST['item-qty'];
  $i = count($q);
  $k = 0;
  
  while ($k &lt; $i) {
    $select = 'SELECT * FROM location';
    $query = $db-&gt;rq($select);
    $price = $db-&gt;fetch($query);
  
    if ($_POST['item-qty'][$k] &lt; 3) {
  
        $get = $price['normal_price'];
        $price = $get * $_POST['item-qty'][$k];
  
        $_SESSION['order'][$_POST['item-id'][$k]] = array(
        "item-id" =&gt; $_POST['item-id'][$k],
        "item-qty" =&gt; $_POST['item-qty'][$k],
        "item-name" =&gt; $_POST['item-name'][$k],
        "item-price" =&gt; $price,
         );
  
    } else {
  
        $get = $price['member_price'];
        $price = $get * $_POST['item-qty'][$k];
  
        $_SESSION['order'][$_POST['item-id'][$k]] = array(
        "item-id" =&gt; $_POST['item-id'][$k],
        "item-qty" =&gt; $_POST['item-qty'][$k],
        "item-name" =&gt; $_POST['item-name'][$k],
        "item-price" =&gt; $price,
        );
    }
  }
  </code></pre>
  
  <p>here the array output</p>
  
  <pre><code>Array
  (
  [order] =&gt; Array
      (
          [1] =&gt; Array
              (
                  [item-id] =&gt; 1
                  [item-qty] =&gt; 1
                  [item-name] =&gt; Adidas
                  [item-price] =&gt; 100
              )
  
          [2] =&gt; Array
              (
                  [item-id] =&gt; 2
                  [item-qty] =&gt; 1
                  [item-name] =&gt; Nike
                  [item-price] =&gt; 150
              )
  
      )
  
  )
  </code></pre>
  
  <p><strong>Question :</strong></p>
  
  <ol>
  <li>How to implement other code if <code>item-qty</code> (in all array)  is greater than or equal to 3  will use <code>$price['member_price']</code></li>
  </ol>
  
  <p>let me know :)</p>