Belgin Fish
Belgin Fish

Reputation: 19857

Retrieve value from object PHP

so currently I have a script where running

$obj = $this->search()->browse()->params($aBrowseParams);

returns the following data to $obj

Phpfox_Search_Browse Object
(
    [_iCnt:Phpfox_Search_Browse:private] => 2


    [_aParams:Phpfox_Search_Browse:private] => Array
        (
            [module_id] => music.song
            [alias] => m
            [field] => song_id
            [table] => phpfox_music_song
            [hide_view] => Array
                (
                    [0] => pending
                    [1] => my
                )

            [service] => music.song.browse
        )

    [_oBrowse:Phpfox_Search_Browse:private] => Music_Service_Song_Browse Object
        (
            [_sTable:protected] => 
        )

    [_sView:Phpfox_Search_Browse:private] => 
    [_aConditions] => Array
        (
            [0] => AND ( (m.title LIKE '%test%') )
            [1] => AND m.view_id = 0 AND m.privacy IN(0)
            [2] => AND m.item_id = 0
        )

)

I'm attempting to get the following value

AND ( (m.title LIKE '%test%') )

Now I've tried converting it to an array using

$arr= (array) $obj;

then simply getting the value by specifying

$obj['value']['value'] 

but it's not working, how should I retrieve the value?

Upvotes: 1

Views: 84

Answers (1)

Travis Hegner
Travis Hegner

Reputation: 2495

What about:

$value = $obj->_aConditions[0];

This should work as long as _aConditions is a public array in the object.

Upvotes: 1

Related Questions