Nikk
Nikk

Reputation: 7891

Getting values nested in multiple arrays

I get the response below from a script, and I need to extract board, model, serial number, current and upgrade.

Net\Response Object
(
    [unrecognizedWords:protected] => Array
        (
        )

    [_type:Net\Response:private] => !re
    [attributes:protected] => Array
        (
            [board] => true
            [model] => CRD
            [serialnumber] => XXXXXXXX
            [current] => 5.11
            [upgrade] => 5.11
        )

    [_tag:Net\Message:private] => 
)

I've multiple combinations such as this:

echo unrecognizedWords:protected->attributes:protected->board;

However I can not get the values our of the array.

Can someone help me?

Upvotes: 0

Views: 31

Answers (1)

Leonid Zakharov
Leonid Zakharov

Reputation: 970

You cann't get any protected or private properties of object (only public). Use public methods (getters) of this object (sure, that it's provided).

Read: PHP: Visibility

Upvotes: 1

Related Questions