baao
baao

Reputation: 73301

Get value of object

I don't get it... I have this object:

object(stdClass)#7 (12) {
 ["type"]=> int(0) 
 ["encoding"]=> int(1)
 ["ifsubtype"]=> int(1)
 ["subtype"]=> string(5) "PLAIN"
 ["ifdescription"]=> int(0)
 ["ifid"]=> int(0) 
 ["lines"]=> int(44) 
 ["bytes"]=> int(1078) 
 ["ifdisposition"]=> int(0) 
 ["ifdparameters"]=> int(0) 
 ["ifparameters"]=> int(1) 
 ["parameters"]=> array(1) 
       { [0]=> object(stdClass)#8 (2) 
            { ["attribute"]=> string(7) "charset" 
              ["value"]=> string(5) "utf-8" } } }

and want to get "parameters" -> "value" (last lines)

I get "parameters" like this:

public function get_formated_body() {
        return $this->format->parameters;
    }

but I don't get the "value" field.

I tried every possibility which came into my mind, like:

    return $this->format->parameters->value;
    return $this->format->parameters['value'];

and many useless things more...

Maybe one of you has more in mind. Thanks!

Upvotes: 1

Views: 57

Answers (2)

vaso123
vaso123

Reputation: 12391

Use this

return $this->format->parameters[0]->value;

Upvotes: 2

Ragnar
Ragnar

Reputation: 4578

Use this code:

return $this->format->parameters[0]->value;

parameters is an array and the value is in position 0

Upvotes: 4

Related Questions