title: How to access a particular key->value pair and exclude a specific key->value pair from an associative array in PHP?
body: <p>I've an associative array named <code>$_SESSION[BASE_SESSION_NAME]['my_cart']</code>. For your reference I'm printing the array as below:</p>
  
  <pre><code>Array
  (
      [6f993b72511c37f4ab4d7273066b8160] =&gt; Array
          (
              [pack_id] =&gt; 6f993b72511c37f4ab4d7273066b8160
              [pack_type] =&gt; test
              [pack_type_id] =&gt; 4
              [pack_name] =&gt; NEET XII Biology
              [pack_price] =&gt; 459.00
              [pack_validity] =&gt; Array
                  (
                      [years] =&gt; 1
                      [months] =&gt; 0
                      [days] =&gt; 0
                  )
  
          )
  
      [cart_summary] =&gt; Array
          (
              [total_no_packages] =&gt; 3
              [total_pack_price] =&gt; 1557
              [final_total_pack_price] =&gt; 1557
              [total_pack_discount] =&gt; 0
              [apply_deal_code] =&gt; 0
              [no_of_discounted_packages] =&gt; 0
          )
  
      [67f76ffae26ffdcde7a392c5534c972a] =&gt; Array
          (
              [pack_id] =&gt; 67f76ffae26ffdcde7a392c5534c972a
              [pack_type] =&gt; test
              [pack_type_id] =&gt; 4
              [pack_name] =&gt; NEET XII Chemistry
              [pack_price] =&gt; 599.00
              [pack_validity] =&gt; Array
                  (
                      [years] =&gt; 1
                      [months] =&gt; 0
                      [days] =&gt; 0
                  )
  
          )
  
      [31dc7c5d9b9cb5a2ba968e74efd4a475] =&gt; Array
          (
              [pack_id] =&gt; 31dc7c5d9b9cb5a2ba968e74efd4a475
              [pack_type] =&gt; test
              [pack_type_id] =&gt; 4
              [pack_name] =&gt; NEET XII Physics
              [pack_price] =&gt; 499.00
              [pack_validity] =&gt; Array
                  (
                      [years] =&gt; 1
                      [months] =&gt; 0
                      [days] =&gt; 0
                  )
  
          )
  
  )
  </code></pre>
  
  <p>Now I want to access only the key having pack_id value or a value ok key <code>pack_id</code>.
  i.e.for example the value [31dc7c5d9b9cb5a2ba968e74efd4a475] or the value from key <code>pack_id</code>
  as <code>[pack_id] =&gt; 31dc7c5d9b9cb5a2ba968e74efd4a475</code>.
  But the issue is there is one more array present having key <code>[cart_summary]</code> and I don't want to use any thing from that array.
  I've to fire a query on every such pack_id. So I want to fire a query withe the help of loop. Can anyone help me to resolve this issue? Thanks in advance. The query which I want to use is as follows:</p>
  
  <pre><code>SELECT package_type.package_type_name
  FROM package_type
  JOIN test_packages ON package_type.package_type_id = test_packages.test_pack_type_id
  WHERE test_packages.test_pack_id = '$propsed_pack_id'
  </code></pre>