title: How to Convert Json Array To PHP Array
body: <p>these are my two functions used in model for save &amp; retrieve the  data in my database     </p>
  
  <p>Here is my function for save data //</p>
  
  <pre><code>  public function save_po($supid,$cart,$total)
    {
      $num=rand(1,99999);
      $date=Date('Y-m-d');
      $array_string=json_encode($cart);// $cart is an multi dimensional array here
      $data = array(
     'num' =&gt; $num ,
     'date' =&gt; $date ,
     'supplier' =&gt; $supid,
     'status' =&gt; 'RAISED',
     'items'=&gt;$array_string,
     'terms'=&gt;'Purchase Order Valid For 15days From the day Of Creation',
     'user'=&gt;'1',
     'total'=&gt;$total);
  
           $result=$this-&gt;db-&gt;insert('purchase_order',$data);
          if($this-&gt;db-&gt;affected_rows()&gt;0)
          {
          return TRUE;    
          }
          else
          {
          return FALSE;   
          }   
  
    }
  </code></pre>
  
  <p><strong>here is my code for retrieve the data</strong></p>
  
  <pre><code>    public function get_previous($brand,$model,$sup_id) {
  
  
                       $this-&gt;db-&gt;where('supplier',$sup_id);    
              $result= $this-&gt;db-&gt;get(' purchase_order');
              if($result-&gt;num_rows()&gt;0)
              {
                  $result_array=array();
                  foreach($result-&gt;result_array() as $row)
                  {
                  $result_array[]=$row['items'];
                  }
  
                  return $result_array;
              }
              else
              return FALSE;
  
          } 
  </code></pre>
  
  <p>now i'm calling that retrieve function in my controller like this.</p>
  
  <pre><code> $data['previous']=$this-&gt;purchases_model-&gt;get_previous($x,$y,$z);
   $arr=(array)($data['previous']);
   print_r($arr);// it was giving the below output of array which is in json format.
   $php_array=json_decode($arr); // here it was displaying error like json_decode() expects parameter 1 to be string, array given .
  </code></pre>
  
  <p>Can you please help me to get that data in PHP array format.</p>
  
  <pre><code>(
      [0] =&gt; {"526728b1bdca73ca2919bb92e0dbe197":{"rowid":"526728b1bdca73ca2919bb92e0dbe197","id":"6","qty":"4","price":"25","name":"PARACETMOL","tax":5,"options":{"Brand":"RANBAXY","Category":"MEDICINES","Taxes":"ADDITIONAL(5%)=&gt;5|","FT":5},"subtotal":100}}
      [1] =&gt; {"d28401e301187f7934510c203ffa90e2":{"rowid":"d28401e301187f7934510c203ffa90e2","id":"1","qty":"4","price":"15000","name":"CANVAS2","tax":3000,"options":{"Brand":"MICROMAX","Category":"ANDROID MOBILES","Taxes":"ADDITIONAL(5%)=&gt;3000|","FT":3000},"subtotal":60000}}
      [2] =&gt; {"769f5f6be645e88fcb574d5e2ada318a":{"rowid":"769f5f6be645e88fcb574d5e2ada318a","id":"3","qty":"4","price":"19000","name":"JUNGLE","tax":9120,"options":{"Brand":"MICROMAX","Category":"FEATURED MOBILES","Taxes":"VAT(12%)=&gt;9120|","FT":9120},"subtotal":76000}}
      [3] =&gt; {"8875353ac430b7302eb1bef0660205b3":{"rowid":"8875353ac430b7302eb1bef0660205b3","id":"6","qty":"4","price":"25","name":"PARACETMOL","tax":12,"options":{"Brand":"RANBAXY","Category":"MEDICINES","Taxes":"VAT(12%)=&gt;12|","FT":12},"subtotal":100}}
  )
  </code></pre>
  
  <p>i want to convert this array into php array</p>