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}
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.
How can I do this?
    $data = array();
    $data['cols'] = array(
                    array('id' => 'Sig','label' => 'Sig', 'type' => 'string'),
                    array('id' => 'T','label' => 'Time', 'type' => '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<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<sizeof($s);$i++)
    {
        $flos[]=floatval($s[$i]);
                }
   function toArr(){
   return func_get_args();
   }
    $c = array_map ('toArr',$floa,$flos);
    $temp[] = array('v' => $c);
    $rows[]= array('c' => $temp);
    }
  $data['rows'] = $rows;
  echo json_encode($data); 
This is the output:
{"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.4978768e-5,4.108994e-5],[3.7465044e-5,6.16302e-5]]}]}]}
but I need it to be like this:
   {"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.4978768e-5},{"v":4.108994e-5}]},{"c":[{"v":3.7465044e-5},{"v":6.16302e-5}]}]}