Access array in PHP object -
Access array in PHP object -
i have next php object i'm struggling array item out of object.
examplebatch object ( [file_path:protected] => [title:protected] => [description:protected] => [link:protected] => [items:protected] => array ( ) [raw:protected] => data/example [feed_nid:protected] => array ( [0] => array ( [path] => data/example/example/ [filename] => file.csv ) [1] => array ( [path] => data/example/example/ [filename] => file.csv ) [2] => array ( [path] => dexampleata/example// [filename] => file.csv ) ) [current_item:protected] => [created] => 0 [updated] => 0 [total:protected] => array ( ) [progress:protected] => array ( [fetching] => 1 [parsing] => 1 [processing] => 1 ) )
i need access array containing 3 keys , it's info post processing.
whats best way go grabbing array?
if can edit class, either alter property care public or write getter it:
function getitems() { homecoming $this->items ; }
otherwise if can't edit class itself, can extend since properties want protected means kid class can access them:
class yourclass extends thatclass { public function getitems { //parent $items homecoming $this->items ; } }
then you'll need create instance of yourclass instead of thatclass , items array it.
similarly other protected properties want.
php arrays object
Comments
Post a Comment