title: php json encode large arrays gets truncated
body: <p>I am encountering a problem displaying json with json_encode. Problem is it gets truncated after a certain point. I'm guessing around 2500 lines. I've read a lot of q&amp;a's in stackoverflow and others suggesting to increase memory limit. I've increased it already to 32m
  and it still gets truncated furthermore I don't think it's the problem for i've echoed the memory usage and with true i get 3.5mb and with false i get 1.5mb I also tried encoding it by 1000 but up until a certain point it still truncates.</p>
  
  <p>my json looks like this</p>
  
  <p>{"Id":"1"},{"Words":""},{"Position":"0"},{"Length":"0"},{"Pdf_Id":"1"}</p>
  
  <p>just 2000 more</p>
  
  <p>My code goes something like this:</p>
  
  <p>json file</p>
  
  <pre><code>echo json_encode(array_values($db-&gt;getallqueryjsoncountStart("words_table","Allwords",4000,0)));
  
  
  public function getallqueryjsoncountStart($table,$jsonparentname,$count,$start)
  {
  
      $this-&gt;sqlquery = "select * from $table LIMIT $start,$count";
      $this-&gt;stmt = $this-&gt;conn-&gt;query($this-&gt;sqlquery);
      for ($i = 0; $i &lt; $this-&gt;stmt-&gt;columnCount(); $i++) {
          $col = $this-&gt;stmt-&gt;getColumnMeta($i);
          $columns[] = $col['name'];
      }
      $this-&gt;initcnt = 0;
      $getqueryJson = array();
  
      while($this-&gt;row = $this-&gt;stmt-&gt;fetch()) 
      {
                  for($x = 0;$x &lt; sizeof($columns);$x++)
                  {
                      $getqueryJson[][$columns[$x]] = $this-&gt;row[$columns[$x]];
                  }
      }
      return $getqueryJson;
  }
  </code></pre>