title: How to unserialize an ArrayObject
body: <p><strong>Note</strong>: I have tried using unserialize function but it say that first argument should be an string and not an Object and so my question  - </p>
  
  <p><strong>Q:</strong> How can I unserialize an ArrayObject in php, my ArrayObject contains:</p>
  
  <pre><code>O:11:"ArrayObject":2:{s:14:"shoppingBasket";a:1:{s:6:"offers";a:2:{i:10;a:8:{s:9:"object_id";s:2:"10";s:6:"family";s:8:"Internet";s:8:"is_unica";b:1;s:10:"offer_type";s:6:"Atomic";s:24:"product_specification_id";s:6:"134455";s:20:"contract_constraints";a:5:{s:19:"min_contract_period";s:1:"1";s:13:"notice_period";s:2:"12";s:15:"rollover_period";s:1:"1";s:18:"right_of_wd_period";s:1:"1";s:19:"cancellation_period";s:6:"ALWAYS";}s:15:"financial_terms";a:3:{s:14:"billing_period";a:2:{i:0;s:6:"YEARLY";i:1;s:9:"QUARTERLY";}s:14:"payment_method";a:1:{i:0;s:12:"DIRECT_DEBIT";}s:17:"bill_presentation";a:1:{i:0;s:5:"PAPER";}}s:6:"prices";a:1:{i:25;a:1:{s:9:"object_id";s:2:"25";}}}i:11224;a:8:{s:9:"object_id";s:5:"11224";s:6:"family";s:8:"Internet";s:8:"is_unica";b:0;s:10:"offer_type";s:11:"DOUBLE_PLAY";s:24:"product_specification_id";s:5:"32567";s:20:"contract_constraints";a:5:{s:19:"min_contract_period";s:1:"8";s:13:"notice_period";s:1:"2";s:15:"rollover_period";s:1:"6";s:18:"right_of_wd_period";s:1:"1";s:19:"cancellation_period";s:12:"END_OF_MONTH";}s:15:"financial_terms";a:3:{s:14:"billing_period";a:2:{i:0;s:6:"YEARLY";i:1;s:9:"QUARTERLY";}s:14:"payment_method";a:1:{i:0;s:12:"DIRECT_DEBIT";}s:17:"bill_presentation";a:1:{i:0;s:5:"PAPER";}}s:6:"prices";a:0:{}}}}s:15:"recommendations";a:1:{i:10017;a:7:{s:9:"object_id";s:5:"10017";s:10:"offer_type";s:6:"Atomic";s:6:"family";s:0:"";s:8:"is_unica";b:0;s:15:"financial_terms";a:3:{s:14:"billing_period";a:1:{i:0;s:9:"QUARTERLY";}s:14:"payment_method";a:1:{i:0;s:12:"DIRECT_DEBIT";}s:17:"bill_presentation";a:1:{i:0;s:5:"PAPER";}}s:20:"contract_constraints";a:5:{s:19:"min_contract_period";i:24;s:19:"cancellation_period";s:6:"ALWAYS";s:13:"notice_period";i:3;s:15:"rollover_period";i:2;s:18:"right_of_wd_period";i:1;}s:6:"prices";a:1:{i:99;a:1:{s:9:"object_id";s:2:"99";}}}}}
  </code></pre>
  
  <p>Here is the code which gives this serialized output and I want to unserialize it. </p>
  
  <pre><code>private function associateCollateral($entities)
              {
                      //var_dump($entities);
  
                      // Extract all object ids from the given set of ids, and pass into the getContentId.
                      $content_ids = $this-&gt;getCollateralDao()-&gt;getContentId(array_keys($entities-&gt;offsetGet('recommendations')));
                      // Call to CMS to get collateral content.
                      /*foreach($content_ids as $content_id)
                      {
                               $contentObj = CmsObjectHandler::get(OBJECT_TYPE_CONTENT,$content_id);
                               $content = $contentObj-&gt;getContent();
                               $result += $content;
                               echo"Here \n";
                               print_r($result)."\n";
                               //exit();
                      }*/
                      var_dump($entities);  ---STEP1
                      return $entities;     ---STEP2
                      //var_dump($entities);  ---STEP3
                      //exit();
              }
  </code></pre>
  
  <p>Step 2 returns serialized output and now I want to unserialize it. </p>