0

I have the following content in an PHP array.

Array content with print_r:

Array ( [0] => Networks Object (
    [_data:Networks:private] => Array (
        [id] => 213
        [name] => Netflix
        [logo_path] => /wwemzKWzjKYJFfCeiB57q3r4Bcm.png
        [origin_country] =>
        )
    )
)

Array content with var_dump

array(1) {
    [0]=> object(Networks)#10 (1) {
        ["_data":"Networks":private]=> array(4) {
            ["id"]=> int(213)
            ["name"]=> string(7) "Netflix"
            ["logo_path"]=> string(32) "/wwemzKWzjKYJFfCeiB57q3r4Bcm.png"
            ["origin_country"]=> string(0) ""
        }
    }
}

---update---

The class

<?php
class Networks {
    private $_data;

    public function __construct($data) {
        $this->_data = $data;
    }

    public function getName() {
        return $this->_data['name'];
    }
}
?>

How can I get the ["name"] value Netflix?

Thank you,

Aknot
  • 499
  • 1
  • 8
  • 18

0 Answers0