How to access the members of this data in PHP?

Posted by George Edison on Stack Overflow See other posts from Stack Overflow or by George Edison
Published on 2010-04-17T03:01:00Z Indexed on 2010/04/17 3:23 UTC
Read the original article Hit count: 218

Filed under:
|
|
|

Okay. Now I give up. I have been playing with this for hours.

  • I have a variable name $data.
  • The variable contains these contents: (extracted by using var_export())

    array (
      'headers' =>
      array (
        'content-type' => 'multipart/alternative; boundary="_689e1a7d-7a0a-442a-bd6c-a1fb1dc2993e_"',
      ),
      'ctype_parameters' => 
      array (
        'boundary' => '_689e1a7d-7a0a-442a-bd6c-a1fb1dc2993e_',
      ),
      'parts' => 
      array (
        0 => 
        stdClass::__set_state(array(
          'headers' => 
          array (
            'content-type' => 'text/plain; charset="iso-8859-1"',
            'content-transfer-encoding' => 'quoted-printable',
          ),
          'ctype_primary' => 'text',
        )),
      ),
    )
    

    I removed some non-essential data.

  • I want to access the headers value (on the second line above) - simple: $data->headers
  • I want to access the headers value (on the fourteenth line after the stdClass:: stuff) - how?

How can I possibly access the values within the stdClass::__set_state section?

I tried var_export($data->parts); but all I get is

NULL

© Stack Overflow or respective owner

Related posts about php

Related posts about access