title: array_push() expects parameter 1 to be array with array_push using keys
body: <p>I am trying to loop a json object and push selected values into array using keys.</p>
  <pre><code>$json = ' { &quot;from&quot;: 1, &quot;to&quot;: 2, &quot;total&quot;: 2, &quot;currentPage&quot;: 1, &quot;totalPages&quot;: 1, &quot;queryTime&quot;: &quot;0.004&quot;, &quot;totalTime&quot;: &quot;0.020&quot;, &quot;partial&quot;: false, &quot;canonicalUrl&quot;: &quot;/v1/products(offers.type=deal_of_the_day)?format=json&amp;apiKey=946n9vuhdkgeyz2qx2dpxd54&quot;,&quot;products&quot;: [ { &quot;sku&quot;: 5998225, &quot;productId&quot;: 1219180376135, &quot;name&quot;: &quot;LG - 1.1 Cu. Ft. Mid-Size Microwave - Black&quot;, &quot;source&quot;: &quot;bestbuy&quot;, &quot;type&quot;: &quot;HardGood&quot;, &quot;startDate&quot;: &quot;2014-07-06&quot;,&quot;new&quot;: false, &quot;active&quot;: true, &quot;lowPriceGuarantee&quot;: true, &quot;activeUpdateDate&quot;: &quot;2014-11-03T19:43:46&quot;, &quot;regularPrice&quot;: 124.99, &quot;salePrice&quot;: 99.99, &quot;onSale&quot;: true},{ &quot;sku&quot;: 2634897, &quot;productId&quot;: 1218343205770, &quot;name&quot;: &quot;Rocketfish In-Wall HDMI Cable&quot;, &quot;source&quot;: &quot;bestbuy&quot;, &quot;type&quot;: &quot;HardGood&quot;, &quot;startDate&quot;: &quot;2011-08-14&quot;, &quot;new&quot;: false, &quot;active&quot;: true,&quot;lowPriceGuarantee&quot;: false, &quot;activeUpdateDate&quot;: &quot;2014-11-03T18:03:02&quot;, &quot;regularPrice&quot;: 29.99, &quot;salePrice&quot;: 24.99, &quot;onSale&quot;: true } ] }';
  
  $json_output = json_decode($json);
  $pBB = array();
  foreach($json_output-&gt;products as $obj){
      array_push($pBB['title'],&quot; {$obj-&gt;name}&quot; );
      array_push($pBB['type'],&quot; {$obj-&gt;type}&quot; );
      //array_push($pBB,&quot; {$obj-&gt;name}&quot; );  without key works fine
  }
  echo  json_encode($pBB);
  </code></pre>
  <p>and below is the error i am getting</p>
  <pre><code>&lt;br /&gt;
  &lt;b&gt;Warning&lt;/b&gt;:  array_push() expects parameter 1 to be array, null given on line &lt;b&gt;6&lt;/b&gt;&lt;br /&gt;
  &lt;br /&gt;
  &lt;b&gt;Warning&lt;/b&gt;:  array_push() expects parameter 1 to be array, null given on line &lt;b&gt;6&lt;/b&gt;&lt;br /&gt;
  {&quot;title&quot;:null}
  </code></pre>
  <p>If i push the values without keys it works and i get below output</p>
  <pre><code>[&quot; LG - 1.1 Cu. Ft. Mid-Size Microwave - Black&quot;,&quot; Rocketfish In-Wall HDMI Cable&quot;]
  </code></pre>
  <p>Any thoughts?</p>