title: how to use array_push for json_encode
body: <p>I am iOS developer and I am making Webservices in PHP for getting JSON Response.</p>
  
  <p>Code which I wrote is:</p>
  
  <pre><code>    $result = mysqli_query($con,"SELECT * FROM wp_marketcatagories");
      $data =array();
      while($row = mysqli_fetch_array($result))
                   {
                   $data[] = array_push($data, array('id' =&gt; $row['id']));
                   }
      $json = json_encode($data);
      echo $json;
  </code></pre>
  
  <p>This is what I want in result:</p>
  
  <pre><code>[{"id":"1"},{"id":"2"},{"id":"3"},{"id":"4"},{"id":"5"},{"id":"6"},{"id":"7"},{"id":"8"},{"id":"9"},{"id":"10"},{"id":"11"},{"id":"12"}]
  </code></pre>
  
  <p>But above code is giving me like this:</p>
  
  <pre><code>[{"id":"1"},1,{"id":"2"},3,{"id":"3"},5,{"id":"4"},7,{"id":"5"},9,{"id":"6"},11,{"id":"7"},13,{"id":"8"},15,{"id":"9"},17,{"id":"10"},19,{"id":"11"},21,{"id":"12"},23]
  </code></pre>
  
  <p>From where this 1, 3, 5 ,....  are coming ?</p>