Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Unserialize

$
0
0
Hi,
 
I am trying to get the values of field1 and field20 from the following unserialized output:
stdClass::__set_state(array(
  'id' => 'xxx',
  'products' => 
  stdClass::__set_state(array(
    'product' => 
    stdClass::__set_state(array(              
      'field1' => '123',
      'field2' => '',
      'field3' => 
      stdClass::__set_state(array(
      )),      
      #various other fields        
      'field20' => '456',    
    )),
  )),
))
 
I have tried this code but it doesn't seem to be working, can someone tell me what I am doing wrong here please?
 
$result = unserialize($api->getResponseSerialized());                                
foreach ($result->products->product as $product) {
  $product->field1; //doesnt work!!!                                      
}
 

Viewing all articles
Browse latest Browse all 13200

Trending Articles