title: Make a json object with two arrays in PHP
body: <p>By getting query from MySQL, I have 2 arrays like this:
  for  example:
  Sig:{a,b,c,d,e}
  T:{1,2,3,4,5}</p>
  
  <p>Now, in PHP, I want to merge these two arrays and have an array like: {(a,1),(b,2),(c,3),(d,4),(e,5)} then, show it as a JSON in order to draw chart by the Google visualize API.</p>
  
  <p>How can I do this?</p>
  
  <pre><code>    $data = array();
      $data['cols'] = array(
                      array('id' =&gt; 'Sig','label' =&gt; 'Sig', 'type' =&gt; 'string'),
                      array('id' =&gt; 'T','label' =&gt; 'Time', 'type' =&gt; 'string')
                      );
  
     $rows = array();
     while($r = mysql_fetch_assoc($result)) {
     $temp = array();
  
  //changing the string (data in MySQL) into array of float for column Sig
     $csvdata = $r['Sig'];
     $a = explode(',', $csvdata);
  
      for($i=0;$i&lt;sizeof($a);$i++)
      {
          $floa[]=floatval($a[$i]);
                  }
  
  //changing the string (data in MySQL) into array of float for column T
     $csvdata = $r['T'];
     $s = explode(',', $csvdata);
     for($i=0;$i&lt;sizeof($s);$i++)
      {
          $flos[]=floatval($s[$i]);
                  }
  
     function toArr(){
     return func_get_args();
     }
  
      $c = array_map ('toArr',$floa,$flos);
      $temp[] = array('v' =&gt; $c);
  
      $rows[]= array('c' =&gt; $temp);
      }
  
    $data['rows'] = $rows;
    echo json_encode($data); 
  </code></pre>
  
  <p>This is the output:</p>
  
  <pre><code>{"cols":[{"id":"Sig","label":"Sig","type":"string"},{"id":"T","label":"Time",‌​"type":"string"}],"rows":[{"c":[{"v":[[0,0],[1.2490004e-5,2.0545915e-5],[2.497876‌​8e-5,4.108994e-5],[3.7465044e-5,6.16302e-5]]}]}]}
  </code></pre>
  
  <p>but I need it to be like this: </p>
  
  <pre><code>   {"cols":[{"id":"Sig","label":"Sig","type":"string"},{"id":"T","label":‌"Time",‌"type":"string"}],"rows":[{"c":[{"v":0},{"v":0}]},{"c":[{"v":1.2490004e-5},{"v":2.0545915e-5}]},‌{"c":[{"v":2.497876‌8e-5},{"v":4.108994e-5}]},{"c":[{"v":3.7465044e-5},{"v":6.16302e-5}]}]}
  </code></pre>