title: Convert php 2D array
body: <p>Firstly what I am trying is creating a pie chart using google chart api. There I have to feed an javascript array of array. Now what I have in server side is an php array of following structure:</p>
  
  <pre><code>[
    {
      "name": "a",
      "price": 25200
    },
    {
      "name": "b",
      "price": 13500
    }
  ]
  </code></pre>
  
  <p>What I need is:</p>
  
  <pre><code>[
    [
      "a": 25200
    ],
    [
      "b": 13500
    ]
  ]
  </code></pre>
  
  <p>What I have so far - used the following php function to convert.</p>
  
  <pre><code>public function convert($packages){
      $packageShare = array(array());
      $count = count($packages);
      for($i = 0; $i &lt; $count; $i++){    
          $pack = array();
  
          $pack[$packages[$i]['name']] = $packages[$i]['price'];
  
          $packageShare[$i] = $pack;
     }
     return $packageShare;
  }
  </code></pre>
  
  <p>But the output was not what I want. Here is what the above function returns:</p>
  
  <pre><code>[
    {
      "a": 25200
    },
    {
      "b": 13500
    }
  ]
  </code></pre>
  
  <p>N.B. I need to feed this array in <code>google chart api</code> which takes something like this in javascript.</p>
  
  <p>[ [0, 0],   [1, 10],  [2, 12] ]</p>
  
  <p>What can be the standard way to feed?</p>